Tag: uibutton

无法正确添加导航button使用iOS的UIPageViewController

对于我的项目UIPageViewController可能是一个不错的select,所以,我开始使用由XCode 6.4提供的模板开始新的项目。 我使用了模板:基于页面的应用程序已经基本实现了UIPageViewController。 滚动页面的机会工作正常,但是,我想添加导航栏以及。 在阅读了关于这个主题的文章后,我尝试将DataViewControllerembedded到NavigationController(Editor> Embed)中,然后使用Interface Builder中的Storyboard添加导航栏button。 但是,当我编译应用程序时,我看不到那个button。 此外,当您按下导航栏button应该位于的位置时,看起来后面的导航适用于页面,但button不可见。 后来我发现后面的导航不仅在那个地方,而且在视图的所有左边缘都起作用。 这似乎是一个错误。 1.如何使导航栏后退button可见? 2.如何删除导航反应的所有保证金,而不是只是位置的button导航反应?

在Swift中“以NSExceptiontypes的未捕获exception终止”

当我点击一个button的应用程序只是崩溃,我得到这个错误: 2015-06-12 19:33:16.150 scroll view[79136:11092579] -[scroll_view.ViewController Action:]: unrecognized selector sent to instance 0x7f834148bdd0 2015-06-12 19:33:16.153 scroll view[79136:11092579] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[scroll_view.ViewController Action:]: unrecognized selector sent to instance 0x7f834148bdd0' *** First throw call stack: ( 0 CoreFoundation 0x0000000103766c65 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x00000001052d1bb7 objc_exception_throw + 45 2 CoreFoundation 0x000000010376e0ad […]

在应用程序从后台返回后,UIButton imageForState不正确

我有一个在.h文件中声明的UIButton @property (retain, nonatomic) IBOutlet UIButton *btnQuarter; 当我有 if ([self.btnQuarter imageForState:UIControlStateNormal] == [UIImage imageNamed:@"match.png"]) 一旦应用程序加载它完美的作品。 但是,当应用程序从locking或在主屏幕上返回时,它不起作用。

制作一个拉出式托盘 – (iOS)

我正在制作一个iPad应用程序,基本上,我想制作一个从应用程序底部拉出的托盘,并且我希望在屏幕底部有一个小标签,如果您拉动,它会带来形成图像,图像的高度将与您按下button的高度相匹配。 这有点像通知中心如何工作,除了标签总是可见的。 所以我的问题是,我将如何让图像跟随标签,因为它在屏幕上垂直移动? 我会假设使用一个UIButton的标签和托盘的UIImage将是有道理的,我有一些代码让button移动,但你怎么能使一个对象跟随另一个? 谢谢你的帮助,卡尔

UIButton不会出现在iOS 9的视图中

我已经在iOS 8中创build了我的项目,它工作正常,现在我试图在iOS9中运行.UIButton没有出现。 我已经创build了一个button编程,但它不是只出现在iOS9。 它在iOS7和iOS8中工作正常。 请看下面的代码。 UIButton *NewOrderButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [NewOrderButton addTarget:self action:@selector(ButtonClicked:) forControlEvents:UIControlEventTouchUpInside]; [NewOrderButton setTitle:@"Create" forState:UIControlStateNormal]; NewOrderButton.frame = CGRectMake((self.view.frame.size.width-200)/2,(self.view.frame.size.height+80)/2, 200, 40.0); [NewOrderButton.layer setBorderWidth:1]; [NewOrderButton.layer setBorderColor:[[UIColor whiteColor] CGColor]]; NewOrderButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; [self.view addSubview:NewOrderButton]; 如果我debugging这个代码,然后button出现。

在OnTouchUp和OnTouchDown的Swift UIButton背景更改?

我使用的是swift,在我的应用程序中有一个UIButton,为此我想在键上改变背景颜色和边框颜色。

如何在iPhone中以编程方式添加下一个和上一个button?

在图像视图中,如何在iPhone中以编程方式添加下一个和上一个button(前后选项)?

Swift 3 Button文本自动resize

所以我有button,基于设备自动resize,我想知道如何使button文本调整自己像一个UILable与最小的大小或规模。

调整字体大小以适应多个UIButton,使它们都具有相同的字体大小

我有几个UIButton在一起,我想调整字体大小,以便它适合。 但是,每个button应使用相同的字体大小,以使它们看起来相同。 换句话说,我想要做的就是将所有button设置为相同的最小尺寸。 _button1.titleLabel.adjustsFontSizeToFitWidth = YES; _button2.titleLabel.adjustsFontSizeToFitWidth = YES; float minFont1 = _button1.titleLabel.font.pointSize; float minFont2 = _button2.titleLabel.font.pointSize; float fontSize = MIN(minFont1, minFont2); UIFont *tailoredFont = [_button1.titleLabel.font fontWithSize:fontSize]; _button1.titleLabel.font = tailoredFont; _button2.titleLabel.font = tailoredFont; 但是,这不起作用,因为titleLabel.font不反映字体的真实大小。

从另一个class级访问IBOutlet

嘿,我有两个UIViewControllers 。 在第一个,有一个包含图像的UIButton 。 当用户到达我的第二个ViewController ,有许多button,其中包含不同的图像。 所以,当用户在我的VC2中按下一个button时,它应该将自己的图像设置到我的VC1上的UIButton。 我已经实现了第一个VC,在@interface ViewController2 ()之前添加了: #import "ViewController1.h"到ViewController2.m , 我怎样才能做到这一点? 例如: VC2: – (IBAction)seaButton:(id)sender { //Access the IBOutlet from VC1 and set the image of the Button like: UIImage * seaBtnImage = [UIImage imageNamed:@"Sea.png"]; [buttonOutlet setImage:seaBtnImage forState:UIControlStateNormal]; } 谢谢!