<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Neil的備忘錄

    just do it
    posts - 66, comments - 8, trackbacks - 0, articles - 0

    Iphone 帶NavigationBar的ModalView

    Posted on 2010-10-06 18:16 Neil's NoteBook 閱讀(984) 評論(0)  編輯  收藏 所屬分類: Iphone Development
    在沒有安裝顯卡驅動的雪豹下開發(fā)真是痛苦!
    悲劇的thinkpad。。。所以不能截圖。。。稀爛!
    1. 創(chuàng)建一個viewcontroller,比如SettingViewController,同時創(chuàng)建實現(xiàn)文件和頭文件,不多說
    2. 創(chuàng)建該viewcontroller對應的view文件,比如SettingView.xib,沒什么好說的
    3. 雙擊剛才創(chuàng)建的xib文件,指定class為第一步創(chuàng)建的viewcontroller,在interface builder中將view和file owner連接起來
    4. 在創(chuàng)建的SettingViewController.h文件中定義一個bool類型的變量,該變量用來指示modal view是否已彈出,代碼如下:

    @interface SettingViewController : UIViewController {

    BOOL isPushedView;

    }

    @property (nonatomic, readwrite) BOOL isPushedView;

    5. 在SettingViewController.m文件中添加具體實現(xiàn)代碼,如下:

    @implementation SettingViewController

    @synthesize isPushedView;

    - (void)viewDidLoad {

        [super viewDidLoad];

        if(isPushedView == NO) {

            self.navigationItem.title = @"設置";

            self.navigationController.navigationBar.barStyle = UIBarStyleBlack;

            self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"完成" style:UIBarButtonItemStylePlain target:self     action:@selector(cancel_Clicked:)] autorelease];

        }

    }


    -(void) cancel_Clicked:(id)sender {    

        [self.navigationController dismissModalViewControllerAnimated:YES];     

    }


    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

        // Return YES for supported orientations

        return (interfaceOrientation == UIInterfaceOrientationPortrait);

    }

    6. 在RootViewController.h文件中定義變量,代碼如下:

    @class SettingViewController;

    @interface RootViewController : UITableViewController {

    SettingViewController *settingViewController;

    UINavigationController *settingNavController;

    }

    7. 在RootViewController.m文件中添加實現(xiàn)代碼,如下:

    - (void) settingClicked {  

    if(settingViewController == nil) {

    settingViewController = [[SettingViewController alloc] initWithNibName:@"SettingView" bundle:[NSBundle mainBundle]];

    settingViewController.isPushedView = NO;

    }

        if(settingNavController == nil) {

            settingNavController = [[UINavigationController alloc] initWithRootViewController:settingViewController];

    [self.navigationController presentModalViewController:settingNavController animated:YES];  

    }

    }

    8. DONE!!!

    主站蜘蛛池模板: 国产亚洲精品激情都市| 日日AV拍夜夜添久久免费| 亚洲色欲久久久久综合网| 黄色免费在线网址| 免费大香伊蕉在人线国产| 亚洲AV女人18毛片水真多| 高清国语自产拍免费视频国产 | 亚洲五月丁香综合视频| 18禁美女裸体免费网站| 亚洲色图黄色小说| 99久久久精品免费观看国产| 亚洲欧洲精品在线| 美女视频黄免费亚洲| 亚洲色大成网站www尤物| 国产大片51精品免费观看| 日本中文字幕免费看| 亚洲人成网7777777国产| 免费国产成人α片| 亚洲精品天天影视综合网| 免费黄色网址网站| 亚洲久热无码av中文字幕 | 免费人成在线观看视频播放| 免费人成再在线观看网站| 国产精品亚洲综合一区| 日本免费中文字幕| 亚洲欧洲国产精品久久| 大香人蕉免费视频75| 成人嫩草影院免费观看| 亚洲Av永久无码精品三区在线| www.免费在线观看| 国产精品亚洲av色欲三区| 久久久久噜噜噜亚洲熟女综合| 日本中文字幕免费高清视频| 亚洲一线产区二线产区精华| 韩国18福利视频免费观看| 在线观看免费视频一区| 国产午夜亚洲精品| 亚洲精品国产日韩无码AV永久免费网| 久久99免费视频| 亚洲av无码片vr一区二区三区 | 亚洲一区二区三区乱码在线欧洲|