0
保存在我的代碼我創造了這個的Xcode 4.5導航控制器和後退按鈕如何將值
#import <UIKit/UIKit.h>
@interface ViewControllerTable : UIViewController <UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *myTableView;
@property (strong, nonatomic) NSString *plcVar;
@end
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
listaPlacas *placas = [[listaPlacas alloc]init];
[self.navigationController pushViewController:placas animated:YES];
}
但另一種觀點認爲:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
for (UITableViewCell *cell in [tableView visibleCells]) {
cell.accessoryType = UITableViewCellAccessoryNone;
}
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.accessoryType = UITableViewCellAccessoryCheckmark;
NSString *placaVar = cell.textLabel.text;
ViewControllerTable *VCT = [[ViewControllerTable alloc]init];
VCT.plcVar = [[NSString alloc]init];
VCT.plcVar = placaVar;
}
當我後退按鈕點擊變量的值plcVar是空的。
不與本孔德 – user2354996 2013-05-06 23:00:31
@ user2354996工作 - 對不起,代碼錯誤 - 我已經糾正了它 – foundry 2013-05-07 01:10:21