uibutton

Customizing the buttons on a UIAlertView

泪湿孤枕 提交于 2020-01-21 10:11:45
问题 This is the current way i'm customizing my buttons: UIAlertView *av = [[UIAlertView alloc] init]; [av addButtonWithTitle:@""]; UIButton *yesButton = [av.subviews lastObject]; [av show]; [yesButton setImage:[UIImage imageNamed:@"test.png"] forState:UIControlStateNormal]; The problem with this is that the original view is still visible around the image I set for the button. It doesn't completely encapsulate the image. Here's an example of what I have so far: https://www.dropbox.com/s

Xcode iOS push down button and drag then up on a second button

你离开我真会死。 提交于 2020-01-21 10:01:25
问题 Lets say I wan't to add 1 to an integer. This will only be done when I push down on a UIButton and then release my finger on another UIButton . A drag combo. Whats the easiest way I can make an IBAction occur out of a combo? This could be done with touch coordinates or maybe just UIButtons and IBActions . How do I create a 2-button combo with IBActions 回答1: Try implementing the button you wish to touch down on as a "Touch Down", "Touch Up Inside", and "Touch Up Outside" button. UIButtons can

Show more button next to end of text Swift

会有一股神秘感。 提交于 2020-01-21 05:00:08
问题 I want to show more button at the end of the text or below if there isn't enough space. I don't understand how Apple developers did this? Please answer in swift. After clicking on more button i want to show all the text. change the button to less. Thanks in advance. 回答1: Here's a great CocoaPod for the functionality you're looking for. https://github.com/ilyapuchka/ReadMoreTextView This will allow you to set a maximum number of lines and customise the text append to the end of the trimmed

iOS 网易彩票-3常见设置

安稳与你 提交于 2020-01-20 03:13:39
Navigation导航设置 为了统一管理导航控制器,需要自定义导航控制器MJNavigationController,继承于UINavigationController。分别设置5个Navigation的控制器Class为此控制器。 白色状态栏 统一背景头部导航栏 设置所有Navigation导航栏字体颜色 二级页面隐藏底部导航条 1.白色状态栏。使用application管理状态栏 设置不使用控制器控制状态栏 在MJAppDelegate中设置: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. application.statusBarStyle=UIStatusBarStyleLightContent; return YES; } 这样会导致程序在启动的时候,有显示状态栏,如图 改进: 程序启动期间隐藏状态栏 程序启动完成显示状态栏 - (BOOL)application:(UIApplication *)application

Keep iPhone UIButton Highlighted

风格不统一 提交于 2020-01-19 05:37:45
问题 I have the following code snippets: @interface Foo: UIViewController { ... UIButton *myButton; ... } @implementation Foo - (void) viewDidLoad { ... myButton.highlighted = YES; ... } When I run the app, the button is highlighted in blue (default behavior). It works as I expected. But after pressing the button once, the button is no longer highlighted. Then, I created an IBAction highlightButton to handle Touch Up Inside event where I explicitly call myButton.highlighted = Yes; . Unfortunately,

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

Deadly 提交于 2020-01-18 11:08:48
问题 Using iOS, how would I go about creating a red "delete" button similar to the one used when deleting contacts on the iPhone? 回答1: 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:@

UIPickerView foreground

巧了我就是萌 提交于 2020-01-17 13:45:26
问题 I have a problem with UIPickerView. I have 9 lists and I created a view with 9 buttons. For each button I have associated a flag: when I click a button, a picker appears with the list relating to selected tag. The problem is that when the picker appears, it's in the background and the buttons are seen above the picker. I have solved in this way: when the user clicks a button the others are set as hidden and the picker looks good. There is a better solution to have the picker in the foreground

i am trying to animate my unbutton with a constraint and the animation is not working

痞子三分冷 提交于 2020-01-17 07:25:06
问题 Can some one please tell me why this is not animating? I feel that the code is all perfect but the animate function is not working. The button is jumping instantly from side to side but like i said it isn't animating... func moveResetButton( constraint : NSLayoutConstraint, isOffScreen : Bool) { if isOffScreen { //animate the button onto the screen UIView.animate(withDuration: 3.0, delay: 0.0, options: .curveLinear, animations: { constraint.constant += 120 }, completion: nil) } else { /

Swift: Determine if the buttons title was changed

帅比萌擦擦* 提交于 2020-01-17 06:28:40
问题 Im a newbie in swift, please bear with me. I have button-A that when clicked show a popover, the popover has a text field and a confirm button. when the confirm is clicked, any value on the text field will be used to change the button-A title. My question is, how can we monitor if the button title was changed? Obviously We can see it visually but my goal is to do it programatically. thoughts? 回答1: An example might help a little here. If a button name myButton I can observe those attributes

how to give constraints for UIbuttons

╄→尐↘猪︶ㄣ 提交于 2020-01-17 04:57:07
问题 how to give constraints for the buttons in the bottom as shown in image. 回答1: select all 5 UIButtons and give equal widths constraints. give following constraints forr all buttons: 1.Height constraint. 2.Leading Constraint. 2.Bottom Constrain. 4.Equal Width Constraint 5.Trailing Constraint(if necessary) check here :Arrange 3 UIButtons(of equal width) side-by-side 来源: https://stackoverflow.com/questions/36515549/how-to-give-constraints-for-uibuttons