我想使用 parse.com 将一些对象从 tableview 传递到视图控制器。我试过了,但它不起作用:我做错了什么吗?有任何想法吗?我还添加了我的详细控制器 .m 和 .h 文件,谢谢..
-(void) tableView: (UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger row = [indexPath row];
NSLog(@"%i",row);
PFObject *object = [self objectAtIndex:indexPath];
//Create a DetailViewController object
MyTableViewDetail * MTD = [[MyTableViewDetail alloc] initWithNibName:@"MyTableViewDetail" bundle:nil];
MTD.label1.text =[object objectForKey:@"columntext"];
//push the detail view controller object onto the stack
[self.navigationController pushViewController:MTD animated:YES];
//tableView.backgroundColor =[UIColor clearColor];
}
我的细节.h:
@interface MyTableViewDetail : UIViewController{
}
@property (strong, nonatomic) IBOutlet UILabel *label1;
@property (strong, nonatomic) IBOutlet UIImageView *imagedetail;
@end
我的 .m 文件:
#import "MyTableViewDetail.h"
#import "MyTableController.h"
@interface MyTableViewDetail ()
@end
@implementation MyTableViewDetail
@synthesize label1;
@synthesize imagedetail;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
-(void)viewDidLoad{
[super viewDidLoad];
}
- (void)viewDidUnload
{
[self setLabel1:nil];
[self setImagedetail:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end