没有可见的@interface为' UIButton'声明选择器' setTitle'

时间:2014-10-04 12:59:45

标签: ios objective-c mobile

好吧所以我刚开始用目标c和iv得到一个非常随机的错误我不知道它试图向我指出什么 我在xviewContoller.h上有这个

@property (weak, nonatomic) IBOutlet UIButton *helloButton;
xviewController.m上的

- (IBAction)showAlrt:(id)sender;

在本页底部的方法中使用

- (IBAction)showAlrt:(id)sender {

    UIAlertView* alert = [[UIAlertView alloc]
                          initWithTitle:@"xxxx"
                          message:@"xxxx"

                          delegate:nil

                          cancelButtonTitle:@"Close"
                          otherButtonTitles:nil];
                          [alert show];

                        [self.helloButton setTitle:@"click"]
                        forState:UIControlStateNormal];
}

然后我收到此错误

'UIButton'没有可见的@interface声明选择器'setTitle'

on like [self.helloButton setTitle .....

有人可以帮忙吗。

1 个答案:

答案 0 :(得分:3)

[self.helloButton setTitle:@"click"]
                    forState:UIControlStateNormal];

更改为

[self.helloButton setTitle:@"click" forState:UIControlStateNormal];