uibutton

Iphone UIButton background color

让人想犯罪 __ 提交于 2020-01-22 15:15:10
问题 I'm creating some UIButton s programmatically in a loop but I'm having some problem with setting the background color of the button. The color of the button always shows up as white. But works fine with I'm only using 2 colors in the backgroundcolor. Eg : red : 255 green:0 blue :200 Here is the code I'm using to add the button. UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(80, 20 + (i*75), 200, 75); button.layer.cornerRadius = 10; button.layer

Iphone UIButton background color

*爱你&永不变心* 提交于 2020-01-22 15:15:09
问题 I'm creating some UIButton s programmatically in a loop but I'm having some problem with setting the background color of the button. The color of the button always shows up as white. But works fine with I'm only using 2 colors in the backgroundcolor. Eg : red : 255 green:0 blue :200 Here is the code I'm using to add the button. UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(80, 20 + (i*75), 200, 75); button.layer.cornerRadius = 10; button.layer

Prevent UIButton's setTitle:forState: animation [duplicate]

你离开我真会死。 提交于 2020-01-22 13:45:26
问题 This question already has answers here : How to stop unwanted UIButton animation on title change? (23 answers) Closed 3 years ago . I am using a NSTimer to update a UIButton 's title every second. It works but the text in the title blinks (animates to alpha 0 and back) automatically. I tried to use button.layer.removeAllAnimations() with no luck, and no exceptions, so QuartzCore seems to be correctly linked. Current non-working paranoid code: UIView.setAnimationsEnabled(false) UIView

iOS 7 SpriteKit - Creating game menus/buttons (Scenes vs. more view controllers)

谁说我不能喝 提交于 2020-01-22 06:18:05
问题 So, I've begun working on a project in SpriteKit, and I'm hoping to be able to implement a "main menu" scene with a few buttons. One would go to a level select screen, one would be options, etc. Then from the level select screen, there would be several other buttons that when selected would start the game and load the selected level. My question is this: how should the project be set up? Should each screen (level select, main menu, options) be its own scene and have one main view controller?

iOS 7 SpriteKit - Creating game menus/buttons (Scenes vs. more view controllers)

纵然是瞬间 提交于 2020-01-22 06:15:48
问题 So, I've begun working on a project in SpriteKit, and I'm hoping to be able to implement a "main menu" scene with a few buttons. One would go to a level select screen, one would be options, etc. Then from the level select screen, there would be several other buttons that when selected would start the game and load the selected level. My question is this: how should the project be set up? Should each screen (level select, main menu, options) be its own scene and have one main view controller?

iOS 7 SpriteKit - Creating game menus/buttons (Scenes vs. more view controllers)

十年热恋 提交于 2020-01-22 06:15:19
问题 So, I've begun working on a project in SpriteKit, and I'm hoping to be able to implement a "main menu" scene with a few buttons. One would go to a level select screen, one would be options, etc. Then from the level select screen, there would be several other buttons that when selected would start the game and load the selected level. My question is this: how should the project be set up? Should each screen (level select, main menu, options) be its own scene and have one main view controller?

Swift - protocol as type as target of button action

醉酒当歌 提交于 2020-01-22 02:01:06
问题 I am trying to create - HeaderView which is subclass of UIView, it contains a close button and a title label. class HeaderView: UIView { private var titleLabel: UILabel! private var closeButton: UIButton! } I don't want to add self as target of closeButton action but want to set myViewController as its target, moreover I want HeaderView class to be reusable. So I declared a protocol: protocol CloseViewProtocol { func closeViewAction(sender: UIButton!) } And declared a variable like this:

How to change tintColor of image in UIButton with imageEdgeInsets?

倾然丶 夕夏残阳落幕 提交于 2020-01-21 19:14:24
问题 I I have an UIButton in my objective-c application. My button was modified adding text and image like: - (void)centerButtonAndImageWithSpacing:(CGFloat)spacing { CGFloat insetAmount = spacing / 2.0; self.imageEdgeInsets = UIEdgeInsetsMake(0, -insetAmount, 0, insetAmount); self.titleEdgeInsets = UIEdgeInsetsMake(0, insetAmount, 0, -insetAmount); self.contentEdgeInsets = UIEdgeInsetsMake(0, insetAmount, 0, insetAmount); } And then I add the image with this code: [self.myButton setImage:[UIImage

How to change tintColor of image in UIButton with imageEdgeInsets?

人盡茶涼 提交于 2020-01-21 19:14:05
问题 I I have an UIButton in my objective-c application. My button was modified adding text and image like: - (void)centerButtonAndImageWithSpacing:(CGFloat)spacing { CGFloat insetAmount = spacing / 2.0; self.imageEdgeInsets = UIEdgeInsetsMake(0, -insetAmount, 0, insetAmount); self.titleEdgeInsets = UIEdgeInsetsMake(0, insetAmount, 0, -insetAmount); self.contentEdgeInsets = UIEdgeInsetsMake(0, insetAmount, 0, insetAmount); } And then I add the image with this code: [self.myButton setImage:[UIImage

UIButton not responding used in a custom UITableViewCell

旧时模样 提交于 2020-01-21 12:44:14
问题 I know this issue is already been asked few times in SO. Despite trying those out, I am still unable to solve my problem. I am using a UITableView inside a UIViewController. I have a custom UITableViewCell which has couple of buttons in it. However, I am not able to make the Button respond to Click event. The development environment is iOS 9 and Swift 2 Snippets used : BranchNearMeTableViewCell.swift contains @IBOutlet weak var btnDetails: UIButton! view controller class func tableView