我正在使用故事板在iOs 5中創建一個應用程序,並且在該應用程序中,我需要爲表視圖使用一個NSMutableArray。 所以我創建該數組,如下所示。 但在iOS 4的我們在創建陣列狀iOs 5中的NSMutable Array
@interface MySpots : UITableViewController{
NSMutableArray *MySpots;
}
@property (nonatomic, strong) NSMutableArray *MySpots;
和.m文件
@synthesize MySpots;
- (void)viewDidLoad
{
[super viewDidLoad];
MySpots = [[NSMutableArray alloc]init];
for (int i = 0; i<10; i++) {
mySpot.SpotName = @"Name Of Spot";
mySpot.SpotTime = @"15mi";
mySpot.SpotDis = @"Short preview of the description will appear in this section.Acts as a reminder for relevant";
[MySpots addObject:mySpot];
}
}
但是當我嘗試這樣做在iOS 5中它會告訴我的錯誤(「預期標識符或{」 )on
MySpots = [[NSMutableArray alloc]init];
因爲在iOs 5中不需要發佈。所以我應該如何在iOs 5中聲明NSMutableArray。 在此先感謝:)
雅,其工作我改變了財產的名稱,它會工作,感謝TriPhoenix –