欢迎来到天天文库
浏览记录
ID:38525765
大小:83.96 KB
页数:16页
时间:2019-06-14
《简单的页面跳转和传值》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#import@interfaceContactViewController:UITableViewController@end#import"ContactViewController.h"#import"Person.h" //人的模型#import"HerosCell.h" //男#import"ScrollCell.h" //女#import"ViewController.h"
2、 //跳转页面@interfaceContactViewController()@property(nonatomic,retain)NSMutableDictionary*dataSource;@property(nonatomic,retain)NSMutableArray*orderAry;@property(nonatomic,copy)NSString*str; //传哪个值@end@implementationContactViewController-(N
3、SMutableDictionary*)dataSource{ if(!_dataSource){ self.dataSource=[NSMutableDictionarydictionary]; } return[[_dataSourceretain]autorelease];}-(NSString*)str{ if(!_str){ self.str=@"name"; } return[[_strretain]autorelease];}-(NSMutableAr
4、ray*)orderAry{ if(!_orderAry){ self.orderAry=[NSMutableArrayarray]; } return[[_orderAryretain]autorelease];}-(void)viewDidLoad{ [superviewDidLoad]; //Uncommentthefollowinglinetopreserveselectionbetweenpresentations. //self.clearsSelection
5、OnViewWillAppear=NO; //UncommentthefollowinglinetodisplayanEditbuttoninthenavigationbarforthisviewcontroller. //self.navigationItem.rightBarButtonItem=self.editButtonItem; [selfreadDataPlist]; }-(IBAction)handleSegment:(UISegmentedControl*)sende
6、r{ self.str=[sendertitleForSegmentAtIndex:sender.selectedSegmentIndex];}-(void)readDataPlist{ NSString*path=[[NSBundlemainBundle]pathForResource:@"yingxiong"ofType:@"plist"]; NSDictionary*dict=[NSDictionarydictionaryWithContentsOfFile:path]; for
7、(NSString*strindict){ NSMutableArray*mArray=[NSMutableArrayarray]; for(NSDictionary*aHerosindict[str]){ Person*person=[[Personalloc]initWithName:aHeros]; [mArrayaddObject:person]; } [self.dataSourcesetObject:mArrayf
8、orKey:str]; } NSArray*ary=[dict.allKeyssortedArrayUsingSelector:@selector(compare:)]; for(NSString*strinary){ [self.orderAryaddObject:str]; } }-(void)didReceiveMemor
此文档下载收益归作者所有