Objective-Cのメモリ管理について混乱しました。例:
.h file
@property(nonatomic,retain) NSString *myString;
.m file
@synthesize myString
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [arrayString count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//in this case,i have to check
if(self.myString != nil)
[myString release],self.myString = nil;
//and assign
self.myString = [arrayString objectAtIndex:indexPath.row];
//or i need only assign
self.myString = [arrayString objectAtIndex:indexPath.row];
}
誰かが私に説明できますか?本当にありがとう。