Animate UIButton state change

This can be done using transition animation of a UIView. It does not matter the isHighlighted property is not animatable, because it transitions the whole view. Swift 3 UIView.transition(with: button, duration: 4.0, options: .transitionCrossDissolve, animations: { button.isHighlighted = true }, completion: nil) Objective-C [UIView transitionWithView:button duration:4.0 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ button.highlighted = YES; } completion:nil];

set cornerRadius and setbackgroundimage to UIButton

Here is how I would create a button through code and set its background color. UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame = CGRectMake(100, 100, 100,50); [btn setTitle:@”Hello” forState:UIControlStateNormal]; [btn setBackgroundColor:[UIColor colorWithRed:128.0/255.0f green:0.0/255.0f blue:0.0/255.0f alpha:0.7]]; btn.frame = CGRectMake(100.0, 100.0, 120.0, 50.0);//width and height should be same value btn.clipsToBounds = YES; btn.layer.cornerRadius = 20;//half of the width … Read more

How can I create a big, red UIButton with iOS?

You first start with a stretchable image: alt text http://grab.by/4lP Then you make a button with the stretched image as the background and apply text. UIButton *sampleButton = [UIButton buttonWithType:UIButtonTypeCustom]; [sampleButton setFrame:CGRectMake(kLeftMargin, 10, self.view.bounds.size.width – kLeftMargin – kRightMargin, 52)]; [sampleButton setTitle:@”Button Title” forState:UIControlStateNormal]; [sampleButton setFont:[UIFont boldSystemFontOfSize:20]]; [sampleButton setBackgroundImage:[[UIImage imageNamed:@”redButton.png”] stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0] forState:UIControlStateNormal]; [sampleButton addTarget:self action:@selector(buttonPressed) … Read more

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