草庐IT

UIBUTTON

全部标签

ios - 在 UIView 加载后加载 UIButton

我有一组按钮显示在UIViewController的中心。为了使按钮在View加载时一个接一个地弹出/出现在View上,我试图弄清楚在我的UIViewController加载后加载UIButtons或者在彼此的一秒内加载,以便它们快速加载但是加载View后按钮会出现视觉动画弹出。有没有人有使用UIButton执行此操作的示例? 最佳答案 最初,当ViewController收到对viewDidLoad的调用时,您希望设置按钮,使它们的alpha为零。然后,在viewDidAppear:中,您可以配置一组动画来显示按钮:[UIView

iphone - 如何根据标题文本增加 UIButton 高度?

我需要根据标题增加UIButton的高度。演示问题的图片如下 最佳答案 正如你所说的动态高度,这是经过全面测试的myButton=[UIButtonbuttonWithType:UIButtonTypeRoundedRect];myButton.titleLabel.numberOfLines=0;myButton.contentHorizontalAlignment=UIControlContentHorizontalAlignmentCenter;NSString*titleOfButton=@"thisistheverylau

ios - UIButton 仅在 UIControlStateNormal 上设置图像

我有一个简单的UIButton问题只有当按钮处于UIControlStateNormal状态时,我才需要在按钮上显示图像,如果我点击它则不显示它。这是我的代码:[cardButtonsetImage:[UIImageimageNamed:@"cardBack.png"]forState:UIControlStateNormal];当一个按钮被点击时,我会改变它的状态:cardButton.selected=card.isFaceUp;现在的问题是,即使按钮的状态切换到UIControlStateSelected,图像仍然存在......我检查了imageForState方法并惊讶地发现

ios - 如何在 UITableViewCell 中垂直居中对齐 UIButton? ( objective-c )

我有一个自定义表格单元格,我想在左侧添加一个自定义UIButton,在单元格内垂直居中。我尝试使用下面显示的代码来做到这一点,它在我的自定义表格单元格实现中。我正在尝试通过获取self.frame的高度并调整按钮的大小使其与单元格的顶部和底部相距5像素来实现垂直居中对齐。当我运行它时,我看到按钮出现在距顶部5像素的位置,但距底部的距离要远得多(20像素左右)。实现垂直对齐的正确方法是什么?这是我在自定义表格单元格实现中的代码:-(id)initWithStyle:(UITableViewCellStyle)stylereuseIdentifier:(NSString*)reuseIde

iphone - 带有圆角和边框的 UIButton

我想在UIButton上设置边框,只在一侧设置圆角我使用这段代码://setroundedcornersontopUIBezierPath*maskPath=[UIBezierPathbezierPathWithRoundedRect:self.scanButton.boundsbyRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)cornerRadii:CGSizeMake(10.0,10.0)];CAShapeLayer*maskLayer=[CAShapeLayerlayer];maskLayer.frame=se

ios - 选择或取消选择时更改 UIButton 的图像

我希望在我的iOS应用程序中,用户可以在单击UIButton时选择一些字段。我希望当用户点击UIButton时选择字段,按钮的图像应该改变并打开我的MMPickerView并且当用户再次点击UIButton应该取消选择并在UIButton中显示上一个图像,此时不要打开MMPickerview。这是我的代码:-(IBAction)showPickerViewButtonPressed:(id)sender{if((_button.selected=!_button.selected)){UIImage*bimage=[UIImageimageNamed:@"play.jpg"];[_bu

c# - 如何在 xamarin ios C# 中以编程方式触发 UIButton 的 TouchUpInside

我正在尝试以编程方式触发Uibutton的touchupinside事件。我怎样才能做到这一点?我尝试使用PerformSelector的代码,但出现此错误"ErrorMT4117:Theregistrarfoundasignaturemismatchinthemethod'VCPAckage2.ActivityViewController.TouchUpInsideEvent'-theselector'TouchUpInsideEvent:'indicatesthemethodtakes1parameters,whilethemanagedmethodhas2parameters."

ios - 如何在 iOS 中创建一个非常自定义的 uibutton,如 UITableViewCellStyleSubtitle

我想创建一个带有图像、标题和描述的按钮,类似于UITableViewCellStyleSubtitle。我想以编程方式执行此操作。有谁知道我怎样才能做到这一点? 最佳答案 您可以创建UIButton类的类别。这是为您准备的准系统设置:在.h文件中:@interfaceUIButton(YourCategoryName)-(void)setupButton:(NSString*)titleimage:(UIImage*)imagedescription:(NSString*)description;@end在.m文件中:@implem

ios - 如何在 UITableView 中打开带有 UIButton 的链接

我创建了以下代码来在UITableView中显示按钮。我想为表格中的每个特定单元格添加点击事件,以通过点击该按钮访问谷歌链接。如何将点击事件添加到特定单元格的按钮选项中并到达谷歌链接?-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{staticNSString*CellIdentifier=@"cell";UITableViewCell*cell=[tableViewdequeueReusableCellWithIdentifier:Cel

iphone - UIButton 无 - IOS

我的viewdidload中有以下内容://Start/PauseButtonUIButton*buttonStart=[UIButtonbuttonWithType:UIButtonTypeCustom];buttonStart.frame=CGRectMake(10,100,100,45);[buttonStartsetBackgroundImage:[UIImageimageNamed:@"pause.png"]forState:UIControlStateNormal];[buttonStartaddTarget:selfaction:@selector(pausePlayBu