uibutton

Equivalent of dynamic type “automatically adjusts font” setting for UIButton in Interface Builder?

自古美人都是妖i 提交于 2020-01-01 04:16:04
问题 A UILabel has a Dynamic Type: Automatically Adjusts Font check-box in the Attributes Inspector in Interface Builder. Is there an equivalent in Interface Builder for automatically adjusting the font size of a UIButton, or does this have to be handled in code? I'm using Xcode 9.0 beta 6, targeting iOS 11. 回答1: Apparently there isn't, but it's not very hard to fix. You can make an extension on UIButton with an @IBInspectable property: extension UIButton { @IBInspectable var

A simple way to put a UIImage in a UIButton

心不动则不痛 提交于 2019-12-31 09:04:12
问题 I have a UIButton in my iPhone app. I set its size to 100x100. I have an image that is 400x200 that I wish to display in the button. The button STILL needs to stay at 100x100... and I want the image to downsize to fit... but keep the correct aspect ratio. I thought that's what "Aspect Fit" was used for. Do I include my image with setImage, or setBackgroundImage? Do I set AspectFit for the button? or the image? or the background image? (I need the smaller images to INCREASE in size. While

How to Get the value(label) from the TextField inside the custom cell of a table View to post on te URL

陌路散爱 提交于 2019-12-31 07:34:51
问题 I want my iOS app to pass to a URL the text the user types. The relevant code is pasted below. WHen I run the app, the text does not get assigned any value. It stays as null. I am new to iOS programming and am probably missing something obvious here. Any help/pointers will be appreciated. Mac OS version : 10.6.8 (64 bit) Xcode version : 3.2.3 In the snapshop.. "I have created a Table View and placed custom cell inside each row of a table. TextField is inside the custom cell view. Post is a

UIButton causing unrecognized selector sent to instance

梦想与她 提交于 2019-12-31 07:33:38
问题 I'm trying to create multiple buttons with a for loop, but I'm having problems using the (sender:) function. I have the following code func setUpButtons(){ for i in 1...3 { let btn: UIButton = UIButton(frame: CGRect(x: 100, y: 100, width: 75, height: 100)) btn.center = CGPoint(x: 20 + 100.0 * CGFloat(i), y: 200) btn.backgroundColor = UIColor.green btn.setTitle("Click Me", for: UIControlState.normal) btn.addTarget(self, action: Selector(("buttonAction:")), for: UIControlEvents.touchUpInside)

iOS - UIButton on UIPageControl not working

淺唱寂寞╮ 提交于 2019-12-31 05:22:05
问题 I am using UIPageControl as indicator between different page (view controllers) of my application. In each of the view controllers, I need to have a different button on the left corner on the UIPageControl. If I place a UIButton at that position on each of the view controllers, I see it on the UIPageControl but the buttons do not respond to the touch event. Is there something I am missing? Or is there an alternative to do this? Thanks. 回答1: I guess the page control and the view controller

uialertview called more than once [closed]

北城以北 提交于 2019-12-31 03:18:24
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . It's Irritating ...!!! I googled about this problem, found some Relative Questions but not Satisfactory Answers . So I have One - (IBAction) method that

Passing multiple tags with UIButton

微笑、不失礼 提交于 2019-12-31 02:57:15
问题 OK I have a specific situation. I am using a custom class to create some buttons and I can set their tag property with unique numbers like: button.tag =[NSNumber numberWithInt:[10]]; This is very useful in another part of my program because I can access this unique tag like: UIButton *clicked= (UIButton *) sender; ButtonTag = [NSString stringWithFormat:@"%d", clicked.tag]; Now I want to pass one more unique property just like this. I am making this up but this is how I envision it button

UIButton title disappears

南笙酒味 提交于 2019-12-31 02:34:29
问题 I have a ViewController with an UIButton inside. When I clicked, the text on the button disappeared. I add all the setTitle for all states, but it continues disappearing. Any idea? This is a part of my code: @interface AddCardViewController : UITableViewController <UITextFieldDelegate>{ UIButton *commit; ...... @implementation AddCardViewController - (void)viewDidLoad{ self.commit = [UIButton buttonWithType: UIButtonTypeCustom]; [self setCommitProperties]; [self.view addSubview:commit]; .....

Iphone UIButton not working in nested UIViews

拈花ヽ惹草 提交于 2019-12-30 17:23:05
问题 This is so damn simple im sure! Im missing something and im exhausted from trying to fix it. hopefully someone can help. The Button in CharacterView.m works but the button nested down in CharacterMale.m does not. I'm not using IB everything is done progmatically. What would cause one button to work and other not? ///////////////////////////////////////////////////////////////////////////////// CharacterController.m //////////////////////////////////////////////////////////////////////////////

Swift Cannot Round the Corners of my UIButton

假装没事ソ 提交于 2019-12-30 13:26:58
问题 I've looked at almost every stackoverflow solution and for some odd reason my button will not round the corners. Can someone check and see what im doing wrong? let goToMapsButton = UIButton(type: .custom) scrollView.addSubview(goToMapsButton) _ = goToMapsButton.anchor(map.bottomAnchor, left: nil, bottom: seperator.topAnchor, right: self.view.rightAnchor, topConstant: 16, leftConstant: 0, bottomConstant: 16, rightConstant: 16, widthConstant: 50, heightConstant: 50) goToMapsButton