Tag: uibutton

隐藏另一个button时居中一个button的约束

我有一个视图控制器上的两个button。 它们高度和宽度相等,间隔很好,以屏幕为中心。 问题是,在某些情况下,其中一个button是隐藏的。 当其中一个button被隐藏时,我想让另一个button居中。 对于我的生活,我一直无法弄清楚如何configuration约束来实现这一点。 我可以移动可见button,使其居中,如果另一个button被隐藏,但似乎只能加载视图后,这使得button“跳”,看起来很愚蠢。

将button添加到UIPickerView – Swift 1.2

我想在UIPickerView (在它的顶部)添加两个UIButtons 。 请看看这个图片中的Cancel和Donebutton: 我该怎么做?

UIButton的 – 分配initWithFrame:与buttonWithType:

鉴于(任意): CGRect frame = CGRectMake(0.0f, 0.0f, 100.0f, 30.0f); 以下两个代码段有什么区别? 1。 UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = frame; 2。 UIButton *button = [[[UIButton alloc] initWithFrame:frame] autorelease];

将图像传递给另一个视图控制器(Swift)

我试图将一个用户上传的图像从一个UIImageView移动到另一个视图控制器上的另一个UIImageView 。 我能够让用户上传一个图像,并保存在第一个UIImageView,但他们按下“后”button后,下一个视图控制器上的UIImageView保持空白。 注意:browsingImage是第二个视图控制器(目标UIImageView)上的UIImageView的名称。 任何帮助将不胜感激! @IBAction func cameraButton(sender: AnyObject) { addNewPicture() } func addNewPicture() { let picker = UIImagePickerController() picker.allowsEditing = true picker.delegate = self presentViewController(picker, animated: true, completion: nil) } func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage!, editingInfo: [NSObject : AnyObject]!) { postingImage.image = image self.dismissViewControllerAnimated(true, completion: nil) } @IBAction func postButton(sender: AnyObject) { performSegueWithIdentifier("toBrowsePage", […]

如何在导航栏中创build后退button

我有2页。 第一个是tableView,第二个是我点击任何一个单元格的方式进入下一个页面(视图)的方式。 我想在导航栏的下一页添加回button。 这是我的代码在视图页面: ViewController.m – (void)viewDidLoad { [super viewDidLoad]; self.lable.text = obji.Name; self.lable2.text = obji.Descript; UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(Back)]; self.navigationItem.leftBarButtonItem = backButton; } – (IBAction)Back { //I dont know that how return pervious page }

UIbutton标题上的自定义字体被剪裁在单词的顶部

我已经上传了一个自定义的字体,并使用下面的代码在UIbutton的标题上应用此字体 videoButton.titleLabel.font = [UIFont fontWithName:@"LaurenScript" size:20]; 问题在于标题正在第一个字母的顶部(见下面的照片)。 我在UIlabel上尝试了相同的字体,它工作正常,所以它不是字体的问题。 我也试着改变使用rectFrame [videoButton.titleLabel setFrame:CGRectMake(0, 0, 300, 600)]; 但那没有做任何事情。 有没有人有我如何解决这个问题的线索? 干杯

如何通过iOS中的参数将UITableView IndexPath传递给UIButton @selector?

我在UITableViewCells添加了UIButton 。 我有当用户点击button我们已经得到的indexpath使用NSMutableArray的值。 我用下面的来获取当前的IndexPath , [getMeButton addTarget:self action:@selector(resendTheErrorMessage:) forControlEvents:UIControlEventTouchUpInside]; -(void) resendTheErrorMessage:(id)sender { NSLog(@"SEnder: %@", sender); //NSLog(@"Index Path : %@", indexpath); } 任何人都可以请帮助我通过当前的indexpath UIButton's 。 提前致谢。 编辑: 这是我从NSLog()获得的输出 <UIButton: 0x864d420; frame = (225 31; 95 16); opaque = NO; tag = 105; layer = <CALayer: 0x864d570>>

如何为两个PNG图像之间的UIButton制作animation?

我有两个我想用作button的PNG。 如何通过在这两个图像之间快速切换来animationUIButton?

目标C:从UIButton类的子类创build的button不起作用

我正在创build一个UIButton的子类,以创build我自己的自定义button。 我的代码如下: //interface file (subclass of uIButton @interface UICustomButton : UIButton { Answer *answer; NSString *btnType; } @property (nonatomic, retain) Answer *answer; @property (nonatomic, assign) NSString *btnType; – (id)initWithAnswer:(Answer *)ans andButtonType:(NSString *)type andFrame:(CGRect)frame; – (void)buttonPressed; @end //Implementation file (.m) @implementation UICustomButton @synthesize answer,btnType; – (id)initWithAnswer:(Answer *)ans andButtonType:(NSString *)type andFrame:(CGRect)frame; { self = [super initWithFrame:frame]; if […]

标签栏上的自定义button变圆

这是我正在做的事情: 注意:截图取自iOS的早期版本 我所能达到的: 码: override func viewWillAppear(animated: Bool) { // Creates image of the Button let imageCameraButton: UIImage! = UIImage(named: "cameraIcon") // Creates a Button let cameraButton = UIButton(type: .Custom) // Sets width and height to the Button cameraButton.frame = CGRectMake(0.0, 0.0, imageCameraButton.size.width, imageCameraButton.size.height); // Sets image to the Button cameraButton.setBackgroundImage(imageCameraButton, forState: .Normal) // Sets […]