ios - 无法运行 iOS 代码

标签 ios xcode uibutton uitextfield uilabel

我是开发 iOS 应用程序的初学者。我正在关注一些教程。只需在按下 UIButton 后尝试将 UILabel 的文本写入 UITextField 的文本。我已经将 UILabel 和 UITextField 连接到 View Controller (在 Storyboard上,在左侧黄色 View Controller 中)。 甚至从不同的教程中尝试了很多次不同的例子;从来不工作。 (虽然教程 Xcode 版本是 4.0,但我正在运行 Xcode 5.0.2)

这是 .h 文件。

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController
{
    IBOutlet UILabel *yazi;
    IBOutlet UITextField *sonuc;
}
-(IBAction)islem:(UIButton *)sender;
@end

这是 .m 文件

#import "ViewController.h"


@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(IBAction)islem: (UIButton *)sender
{
    NSString *degiskenAdi=[yazi text];
    sonuc.text=degiskenAdi;
}

@end

谢谢你的帮助..

最佳答案

您是否检查过您的 IBOutlet 是否已连接到 Nib ?

您应该看到类似这样的内容:http://i.stack.imgur.com/r1O5U.png

关于ios - 无法运行 iOS 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22142379/

相关文章:

iphone - 通过多个线程从 URL 加载图像

ios - CGFloat 地板到 NSInteger

ios - "enable"- 我的 UIButton 成员不存在,为什么?

ios - 呈现模态 UIViewController 时发生奇怪的崩溃

IOS Swift3 卡叠叠加

Xcode 4 : How can I reference project variables/macros in a file template?

ios - 如何在使用 Swift 呈现新的 Viewcontroller 后关闭以前的 Viewcontroller?

objective-c - UIButton 删除触摸覆盖边框

ios - UIButton 上的 AddTarget 未触发

ios - 使用 Photos 框架进行内存管理