The warnings I was getting are as follows:
warning: ’setImage:’ is deprecated (declared at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/
Headers/UITableViewCell.h:199)
warning: ’setText:’ is deprecated (declared at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/
Headers/UITableViewCell.h:199)
Before…
After, doing the mods to get rid of the deprecated warnings:warning: ’setImage:’ is deprecated (declared at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/
Headers/UITableViewCell.h:199)
warning: ’setText:’ is deprecated (declared at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/
Headers/UITableViewCell.h:199)
Before…
//This worked perfect in OS 2.0 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *UserSettingButtonCellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:UserSettingButtonCellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier: UserSettingButtonCellIdentifier] autorelease]; } NSUInteger row = [indexPath row]; UserSetting *rowData = [list objectAtIndex:row]; UIImage *image = [UIImage imageNamed:@"MyImage.png"]; if (row != 0) cell.image = image; //WARNING here cell.text = rowData.name; //WARNING here [rowData release]; return cell; } //the tableView method is completely deprecated. - (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath { return UITableViewCellAccessoryDisclosureIndicator; } |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *UserSettingButtonCellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:UserSettingButtonCellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier: UserSettingButtonCellIdentifier] autorelease]; } NSUInteger row = [indexPath row]; UserSetting *rowData = [list objectAtIndex:row]; UIImage *image = [UIImage imageNamed:@"MyImage.png"]; if (row != 0) cell.imageView.image = image; //FIXED here cell.textLabel.text = rowData.name; //FIXED here #ifdef __IPHONE_3_0 //This is a replacement for the tableView method cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; #endif [rowData release]; return cell; } #ifndef __IPHONE_3_0 - (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath { return UITableViewCellAccessoryDisclosureIndicator; } #endif |
1 comment:
This is a really informative knowledge, Thanks for posting this informative Information. IOS Developer
Post a Comment