UIButton with two lines of text in the title (numberOfLines=2)

You don’t need to add a UILabel to the UIButton. That’s just extra objects and work. Set these properties on the titleLabel of your button. button.titleLabel.lineBreakMode = NSLineBreakByWordWrapping; button.titleLabel.numberOfLines = 2;//if you want unlimited number of lines put 0 Swift: button.titleLabel!.lineBreakMode = NSLineBreakMode.ByWordWrapping button.titleLabel!.numberOfLines = 2//if you want unlimited number of lines put 0

UIButton Long Press Event

You can start off by creating and attaching the UILongPressGestureRecognizer instance to the button. UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)]; [self.button addGestureRecognizer:longPress]; [longPress release]; And then implement the method that handles the gesture – (void)longPress:(UILongPressGestureRecognizer*)gesture { if ( gesture.state == UIGestureRecognizerStateEnded ) { NSLog(@”Long Press”); } } Now this would be the basic approach. … Read more

Keeping a UIButton selected after a touch

How are you setting the images for the different UIControlStates on the button? Are you setting a background image for UIControlStateHighlighted as well as UIControlStateSelected? UIImage *someImage = [UIImage imageNamed:@”SomeResource.png”]; [button setBackgroundImage:someImage forState:UIControlStateHighlighted]; [button setBackgroundImage:someImage forState:UIControlStateSelected]; If you’re setting the selected state on the button touch down event rather than touch up inside, your button … Read more

How can I increase the Tap Area for UIButton?

You can simply adjust the content inset of the button to get your desired size. In code, it will look like this: button.contentEdgeInsets = UIEdgeInsets(top: 12, left: 16, bottom: 12, right: 16) //Or if you specifically want to adjust around the image, instead use button.imageEdgeInsets In interface builder, it will look like this:

Interaction beyond bounds of UIView

Yes. You can override the hitTest:withEvent: method to return a view for a larger set of points than that view contains. See the UIView Class Reference. Edit: Example: – (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { CGFloat radius = 100.0; CGRect frame = CGRectMake(-radius, -radius, self.frame.size.width + radius, self.frame.size.height + radius); if (CGRectContainsPoint(frame, point)) { return self; … Read more

Gesture recognizer and button actions

In the “shouldReceiveTouch” method you should add a condition that will return NO if the touch is in the button. This is from apple SimpleGestureRecognizers example. – (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { // Disallow recognition of tap gestures in the segmented control. if ((touch.view == yourButton)) {//change it to your condition return NO; } return … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)