uibutton

Button changes title every time pressed

和自甴很熟 提交于 2020-01-05 08:55:51
问题 Im trying this, but when i press it it dont changes, it only displays text. Also tried if else functions, but with no results. .h IBOutlet UIButton *poga1; @property (nonatomic, retain) UIButton *poga1; .m @synthesize poga1; - (void)viewDidLoad { [super viewDidLoad]; [poga1 setTitle:@"My Title" forState:UIControlStateNormal]; [poga1 setTitle:@"My Selected Title" forState:UIControlStateSelected]; } 回答1: Try this: If you added a title through the storyboard (the gui interface) then delete it.

Button changes title every time pressed

℡╲_俬逩灬. 提交于 2020-01-05 08:55:26
问题 Im trying this, but when i press it it dont changes, it only displays text. Also tried if else functions, but with no results. .h IBOutlet UIButton *poga1; @property (nonatomic, retain) UIButton *poga1; .m @synthesize poga1; - (void)viewDidLoad { [super viewDidLoad]; [poga1 setTitle:@"My Title" forState:UIControlStateNormal]; [poga1 setTitle:@"My Selected Title" forState:UIControlStateSelected]; } 回答1: Try this: If you added a title through the storyboard (the gui interface) then delete it.

How to change button image added to TableView section header

梦想与她 提交于 2020-01-05 08:54:08
问题 I've added a button to section header which shows a view on clicking it. My need is that I've to show an "Up-arrow" image while view is shown and "Down-arrow" image when view is hidden. How can I achieve this? Please help me ... - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom]; [btn setFrame:CGRectMake(0, 0, 316, 60)]; [btn setTag:section]; [aView addSubview:btn]; [btn addTarget:self action:

UIButton query in swift IOS

北城余情 提交于 2020-01-05 04:35:28
问题 I have a button which is set at 62,62 square. I have an image which is 40,40 square. I want the image in the button (which is easy and done), but I want it at the top of the button frame and I want some text at the bottom. So it looks like this : Any idea how to do this in swift ? I have got so far : button.backgroundColor = UIColor(red: 0.13, green: 0.48, blue: 0.81, alpha: 1.0) button.tag = i button.imageView?.image button.setImage(image, forState: .Normal) button.setTitle("Test", forState:

Xcode - Button looks good in storyboard but not on emulator

被刻印的时光 ゝ 提交于 2020-01-05 04:31:11
问题 When I work with buttons in the storyboard they look good, like this: But when i run the app they turn out like this: Do you guys know why? Here are som settings: Thanks! 回答1: You might have put image in Image attribute of inspector. Put that image in Background attribute of inspector. 回答2: top one in your attribute inspector Type , change that to Custom from Rounded . By the way, our iOS has simulator not emulator . In android sdk we call it emulator ;) 回答3: check the view content mode in

UIDatePicker倒计时 swift

不打扰是莪最后的温柔 提交于 2020-01-05 04:16:58
// // ViewController.swift // UILabelTest // // Created by mac on 15/6/23. // Copyright (c) 2015年 fangyuhao. All rights reserved. // import UIKit class ViewController: UIViewController{ var ctimer:UIDatePicker! var btnstart:UIButton! var leftTime:Int = 180 var timer:NSTimer! override func viewDidLoad() { super.viewDidLoad() ctimer = UIDatePicker(frame: CGRectMake(0, 120.0, 200, 200)) self.ctimer.datePickerMode = UIDatePickerMode.CountDownTimer //必须为60的整数倍,比如设置为100,值自动变为60 self.ctimer.countDownDuration = NSTimeInterval(leftTime) ctimer.addTarget(self, action: "timerChanged", forControlEvents:

How to programmatically set my UIButton image to 'redraw'?

。_饼干妹妹 提交于 2020-01-05 03:33:15
问题 I am using some vector graphics (.png) for my app. In photoshop, I can zoom in and always see a perfectly crisp boundary for simple geometric shapes, like circles. However, on my iPhone, my same graphics look jaggedy and rough. I found that if I change the image fill type to redraw', this helps the problem. So, can someone please confirm if using redraw is the correct solution in this situation? Also, how can I make the image for a programmatically defined button use 'redraw' instead of the

UItableView Replacing Checkmarks with UIButton

好久不见. 提交于 2020-01-04 14:01:32
问题 I just want to use UIButton instead check marks im successful in adding button and making it working as check mark when row selected but only row selection is working button not wise not i want to make it work button as well as cell selection screenshot: http://i.imgur.com/aXiBsfU.png http://i.imgur.com/hQddEGk.png - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row==0) { if (selectAll==0) { selectAll=1; [self.arrForIndPaths

UItableView Replacing Checkmarks with UIButton

旧城冷巷雨未停 提交于 2020-01-04 14:00:56
问题 I just want to use UIButton instead check marks im successful in adding button and making it working as check mark when row selected but only row selection is working button not wise not i want to make it work button as well as cell selection screenshot: http://i.imgur.com/aXiBsfU.png http://i.imgur.com/hQddEGk.png - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row==0) { if (selectAll==0) { selectAll=1; [self.arrForIndPaths

Drawing backgroundcolor & border Vs Background PNGs

≡放荡痞女 提交于 2020-01-04 11:09:14
问题 I want specific RGB hex color for most of the buttons for my iPad Application. What I have done is: I have implemented UIButton Subclass in my project which emulates the required background color, text color & border for buttons - and then I use it everywhere in my project where I need UIButton . My UI/UX designer do not provide PNGs instead he insist that I imitate the same color web site buttons are having with Hex codes. I am more of a background PNGs fan. Now, relation of this question to