UIButton title color change on highlight – How to turn it off?

you can use [UIButton setTitleColor:forState:] for all the states , then title color will remain same for all states. [button setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted]; [button setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; [button setTitleColor:[UIColor redColor] forState:UIControlStateSelected]; Note:To avoide type or paste above code three times you can use following code suggested by Will, [button setTitleColor:[UIColor redColor] forState:(UIControlStateHighlighted | UIControlStateNormal | … Read more

How to set the alpha of an UIImage in SWIFT programmatically?

Luckily I was able to help myself and would like to share with you my solution: Swift 3 // UIImage+Alpha.swift extension UIImage { func alpha(_ value:CGFloat) -> UIImage { UIGraphicsBeginImageContextWithOptions(size, false, scale) draw(at: CGPoint.zero, blendMode: .normal, alpha: value) let newImage = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return newImage! } } The above new Swift extension I added to … Read more

Round Top Corners of a UIButton in Swift

Swift 4: For latest iOS 11 onwards override func viewDidLoad() { super.viewDidLoad() if #available(iOS 11.0, *) { self.viewToRound.clipsToBounds = true viewToRound.layer.cornerRadius = 20 viewToRound.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner] } else { // Fallback on earlier versions } } Earlier iOS (10,9 etc) Versions (works for iOS 11 too) override func viewDidLayoutSubviews() { self.viewToRound.clipsToBounds = true let … Read more

ScrollView not scrolling when dragging on buttons

This is happening because UIButton subviews of the UIScrollView (I assume buttons are added as subviews in your case) are tracking the touches and not the scroll view. UIScrollView method touchesShouldCancelInContentView is the key here. According to its description: “The default returned value is YES if view is not a UIControl object; otherwise, it returns … Read more

Use table view disclosure indicator style for uibutton ios

This can be done entirely with code by placing a UITableViewCell with the disclosure indicator within a UIButton: UITableViewCell *disclosure = [[UITableViewCell alloc] init]; disclosure.frame = button.bounds; disclosure.accessoryType = UITableViewCellAccessoryDisclosureIndicator; disclosure.userInteractionEnabled = NO; [button addSubview:disclosure]; Swift: let disclosure = UITableViewCell() disclosure.frame = button.bounds disclosure.accessoryType = .disclosureIndicator disclosure.isUserInteractionEnabled = false button.addSubview(disclosure)

iOS – Delayed “Touch Down” event for UIButton in UITableViewCell

This is caused by the UIScrollView property delaysContentTouches. It used to be sufficient to just set that property to NO for the UITableView itself, but that will only work for subviews of the table that are not encased in another UIScrollView. UITableViewCells contain an internal scroll view in iOS 7 so you will need to … Read more

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