小编Rey*_*old的帖子

从不兼容的指针类型分配?

我是iPhone开发的新手,基本上都是C语言.我理解变量的概念等等,所以我试图以基本的方式使用它们来更好地掌握这个概念.不幸的是,当我尝试做一些非常简单的事情时,我收到编译器警告:我只想分配我的5个变量值.
ViewController.h代码:
@interface MyApplicationViewController : UIViewController {

IBOutlet UITextView *variable1;
IBOutlet UITextView *variable2;
IBOutlet UITextView *variable3;
IBOutlet UITextView *variable4;
IBOutlet UITextView *variable5;


}
Run Code Online (Sandbox Code Playgroud)

[我知道理论上我可以将这些变量连接到IB中的文本视图,但我不是]

@property (nonatomic, retain) IBOutlet UITextView *variable1;  
@property (nonatomic, retain) IBOutlet UITextView *variable2;  
@property (nonatomic, retain) IBOutlet UITextView *variable3;  
@property (nonatomic, retain) IBOutlet UITextView *variable4;  
@property (nonatomic, retain) IBOutlet UITextView *variable5;  


@end  
Run Code Online (Sandbox Code Playgroud)

ViewController.m代码:

@implementation MyApplicationViewController  
    @synthesize variable1;  
    @synthesize variable2;  
    @synthesize variable3;  
    @synthesize variable4;  
    @synthesize variable5;  
    - (void)viewDidLoad {  
    variable1 = "memory text1"; [Warning]  
    variable2 = "memory text2"; …
Run Code Online (Sandbox Code Playgroud)

iphone xcode objective-c

0
推荐指数
1
解决办法
1822
查看次数

标签 统计

iphone ×1

objective-c ×1

xcode ×1