#import <UIKit/UIKit.h>
#import"RootTableViewController.h"
@interfaceAppDelegate :UIResponder
@property(strong,nonatomic)UIWindow*window;
@end
#import"AppDelegate.h"
@interfaceAppDelegate()
@end
@implementationAppDelegate
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
// Override point for customization after application launch.
self.window.rootViewController= [[UINavigationControlleralloc]initWithRootViewController:[[RootTableViewControlleralloc]initWithStyle:UITableViewStyleGrouped]];
returnYES;
}
- (void)applicationWillResignActive:(UIApplication*)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication*)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication*)application {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication*)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication*)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end
#import <UIKit/UIKit.h>
@interfaceRootTableViewController :UITableViewController
@property(strong,nonatomic)UITableView*tableV;
@property(strong,nonatomic)NSArray*arrTitle;
@property(strong,nonatomic)NSArray*arrimages;
@end
#import"RootTableViewController.h"
@interfaceRootTableViewController()
@end
@implementationRootTableViewController
- (void)viewDidLoad {
[superviewDidLoad];
self.title=@"我";
self.arrTitle=@[@"相冊(cè)",@"收藏",@"錢包",@"卡包"];
self.arrimages=@[@"MoreMyAlbum@2x",@"MoreMyFavorites",@"MoreMyBankCard@2x",@"PayCarddetailVirtualIcon@2x"];
//重用的唯一標(biāo)識(shí)
[self.tableViewregisterClass:[UITableViewCellclass]forCellReuseIdentifier:@"mycell"];
//取消滑動(dòng)
self.tableView.scrollEnabled=NO;
//設(shè)置分隔符的樣式
self.tableV.separatorStyle=UITableViewCellSeparatorStyleNone;
//設(shè)置導(dǎo)航欄的前景色
self.navigationController.navigationBar.titleTextAttributes=@{NSForegroundColorAttributeName:[UIColorcolorWithRed:0.135green:0.098blue:0.104alpha:1.000]};
}
- (void)didReceiveMemoryWarning {
[superdidReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
//顯示分區(qū)
- (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView {
return4;
}
//顯示每個(gè)分區(qū)的內(nèi)容數(shù)量
- (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section {
if(section ==0) {
return1;
}elseif(section ==1){
return4;
}else{
return1;
}
}
- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath {
UITableViewCell*cell = [tableViewdequeueReusableCellWithIdentifier:@"mycell"forIndexPath:indexPath];
if(indexPath.section==0) {
//設(shè)置邊框的數(shù)量
cell.textLabel.numberOfLines=2;
cell.imageView.image= [UIImageimageNamed:@"a.jpeg"];
cell.textLabel.text=@"飛魚\r\n微信號(hào):lcj556611";
cell.imageView.backgroundColor= [UIColorredColor];
//獲取二維碼圖片
UIImage*img = [UIImageimageNamed:@"微信"];
UIImageView*imgV = [[UIImageViewalloc]initWithImage:img];
//啟用用戶交互
imgV.userInteractionEnabled=YES;
[imgVsetFrame:CGRectMake(0,350,40,40)];
cell.accessoryView= imgV;
}
elseif(indexPath.section==1){
cell.textLabel.text=self.arrTitle[indexPath.row];
cell.imageView.image= [UIImageimageNamed:self.arrimages[indexPath.row]];
}elseif(indexPath.section==2){
cell.textLabel.text=@"表情";
cell.imageView.image= [UIImageimageNamed:@"MoreExpressionShops"];
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
}else{
cell.textLabel.text=@"設(shè)置";
cell.imageView.image= [UIImageimageNamed:@"MoreSetting"];
cell.accessoryType=1;
}
returncell;
}
//設(shè)置行高
-(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath
{
if(indexPath.section==0) {
return100;
}
return40;
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
*/
/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/
/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the item to be re-orderable.
return YES;
}
*/
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end