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

标签 ios objective-c mobile

好的,所以我刚开始使用 objective-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”

喜欢[self.helloButton setTitle.....

有人可以帮忙吗

最佳答案

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

改为

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

关于ios - 'UIButton' 没有可见的@interface 声明选择器 'setTitle',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26193070/

相关文章:

ios - 以奇怪的行为一次关闭多个 View Controller

iOS:AFNetworking 2.0 的可移植调试错误

objective-c - 在串口上用read()操作取消线程

android - 开源移动应用程序

android - 如何在多个平台上运行 Phone Gap 应用程序?

GWT 移动端跨平台绘图性能

ios - Swift 面向协议(protocol)编程,解决命名冲突

ios - iOS:在哪里下载uikit和基础框架

ios - 在 UIAlertView 中更改按钮标题颜色

ios - 图案图像如何实现视差效果?