【发布时间】:2013-07-18 17:39:56
【问题描述】:
我是 iOS 开发的新手,在我的 GUI 中隐藏/显示按钮时遇到了一些麻烦。因为我需要一些按钮来显示或消失以及启用或禁用。我在网上学习了一些很棒的教程,但无法弄清楚我的代码出了什么问题。
这是我的 ViewController.h :
/
// ViewController.h
// WeddingVideoBooth
//
// Created by Frédéric Mouza on 15/07/13.
// Copyright (c) 2013 Frédéric Mouza. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController{
IBOutlet UIButton *but_record;
}
@property (nonatomic,retain) IBOutlet UIButton *but_record;
- (IBAction)but_record:(UIButton *)sender;
@end
还有我的 .m 文件:
//
// ViewController.m
// WeddingVideoBooth
//
// Created by Frédéric Mouza on 15/07/13.
// Copyright (c) 2013 Frédéric Mouza. All rights reserved.
//
#import "ViewController.h"
#import "MobileCoreServices/UTCoreTypes.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize but_record;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
but_record.hidden=YES;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)but_record:(UIButton *)sender {
but_record.enabled=NO;
}
@end
这很简单,而且,为了理解,我只是希望当您单击它时禁用该按钮...目前,当您单击它时,该按钮保持不变。我还尝试使用属性“but_record.hidden=YES”隐藏它,但没有任何效果。
有人有想法吗?
再次感谢
【问题讨论】:
-
检查IBAction是否连接到IB
标签: ios objective-c uibutton uikit hidden