jueves, 25 de agosto de 2016

iOS: View ignoring touches but the ones inside its subviews



The "Request product button" was inside "Container view" so I was either unable to click on it or unable to scroll the collection view below the "Container view"

Solution:

Subclass UIView and assign that subclass class to "Container view" and implement the following:

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
    UIView *hitView = [super hitTest:point withEvent:event];
    if (hitView == self) return nil;
    return hitView;

}

[super hitTest:point withEvent:event] will return the view touched that is the deepest in the view hierarchy.

miércoles, 17 de agosto de 2016

iOS: Change back button navigation bar

Objective C

1) Change back button color

self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; // Change back button color

2) Remove back text








Swift

1) Change back button color

self.navigationController!.navigationBar.tintColor = UIColor.whiteColor()

2) Remove back text




Note: You can set the back button color in the IB by clicking on the Navigation Bar and settings its tint color

viernes, 5 de agosto de 2016

iOS: Custom property in interface builder

Objective C

@property (nonatomic, strong) IBInspectable UIImage* customImage;

- (void)awakeFromNib
{
    [super awakeFromNib];
    
    // Do something with customImage
}

Swift

@IBInspectable var customImage: UIImage