导航应用

将前一个工程,做修改。

//

//  AppDelegate.h

//  tableViewDemo

//

//  Created by cloud on 13-3-28.

//  Copyright (c) 2013 cloud. All rights reserved.

//


#import <UIKit/UIKit.h>


@class ViewController;


@interface AppDelegate :UIResponder <UIApplicationDelegate>


@property (strong,nonatomic)UIWindow *window;


@property (strong,nonatomic)UINavigationController *viewController;


@end


修改appDlegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

    self.window = [[[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]]autorelease];

    // Override point for customization after application launch.

    TableViewController *table=[[[TableViewControlleralloc]initWithStyle:UITableViewStylePlain]autorelease];

    self.viewController = [[[UINavigationControlleralloc]initWithRootViewController:table]autorelease];

    self.window.rootViewController =self.viewController;

    [self.windowmakeKeyAndVisible];

    return YES;

}

设置导航栏标题 TableViewController.m

- (void)viewDidLoad

{

    [superviewDidLoad];


    // Uncomment the following line to preserve selection between presentations.

    // self.clearsSelectionOnViewWillAppear = NO;

 

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.

    // self.navigationItem.rightBarButtonItem = self.editButtonItem;

    //self.tableView.rowHeight=80;

   self.title=@"首页";

}

修改弹出子窗口

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{

    // Navigation logic may go here. Create and push another view controller.

   /*

     <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];

     // ...

     // Pass the selected object to the new view controller.

     [self.navigationController pushViewController:detailViewController animated:YES];

     [detailViewController release];

     */

    //UIAlertView *alert=[[[UIAlertView alloc] initWithTitle:@"选中了" message:[NSString stringWithFormat:@"你选中了第%d",indexPath.row] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil] autorelease];

    //[alert show];

   NSString *str=[NSStringstringWithFormat:@"你选中了第%d,%d",indexPath.section,indexPath.row];

    ViewController *vc=[[[ViewControlleralloc]init] autorelease];    

    vc.title=@"第二页";

    [self.navigationControllerpushViewController:vcanimated:YES];

    vc.lblInfo.text=str;

}

源码地址http://download.csdn.net/detail/cloud95/5191487
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值