美文网首页
TableView 微信设置界面

TableView 微信设置界面

作者: lichengjin | 来源:发表于2016-03-19 22:30 被阅读337次

    #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=@[@"相册",@"收藏",@"钱包",@"卡包"];

    self.arrimages=@[@"MoreMyAlbum@2x",@"MoreMyFavorites",@"MoreMyBankCard@2x",@"PayCarddetailVirtualIcon@2x"];

    //重用的唯一标识

    [self.tableViewregisterClass:[UITableViewCellclass]forCellReuseIdentifier:@"mycell"];

    //取消滑动

    self.tableView.scrollEnabled=NO;

    //设置分隔符的样式

    self.tableV.separatorStyle=UITableViewCellSeparatorStyleNone;

    //设置导航栏的前景色

    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

    //显示分区

    - (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView {

    return4;

    }

    //显示每个分区的内容数量

    - (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) {

    //设置边框的数量

    cell.textLabel.numberOfLines=2;

    cell.imageView.image= [UIImageimageNamed:@"a.jpeg"];

    cell.textLabel.text=@"飞鱼\r\n微信号: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=@"设置";

    cell.imageView.image= [UIImageimageNamed:@"MoreSetting"];

    cell.accessoryType=1;

    }

    returncell;

    }

    //设置行高

    -(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

    相关文章

      网友评论

          本文标题:TableView 微信设置界面

          本文链接:https://www.haomeiwen.com/subject/jewhlttx.html