IOS--弹出viewController窗口 自定义底层框架--
print?//通过点击主页面按钮弹出settingpagecontroller窗口 主页面是self.view
//通过点击主页面按钮弹出settingpagecontroller窗口 主页面是self.view
[cpp]
//这是主页面button的点击实现函数
-(ibaction)button_touch:(id)sender{
//settingpage是一个newviewcontroller 在此进行初始化
settingpage*setting_page=[[settingpage alloc] initwithnibname:@"settingpage" bundle:nil];
//设定settingpageviewcontroller的rootviewcontroller是uinavigationcontroller(可以任意设置)
uinavigationcontroller *nav = [[uinavigationcontroller alloc]initwithrootviewcontroller:setting_page];
//设置leftbarbutton为完成按钮
uibarbuttonitem *barbutton = [[uibarbuttonitem alloc] initwithtitle:@"完成"
style:uibarbuttonitemstyledone
target:self action:@selector(achieving:)];
setting_page.navigationitem.leftbarbuttonitem = barbutton;
nav.modalinpopover = no;
nav.modalpresentationstyle = uimodalpresentationformsheet;
[self presentmodalviewcontroller:nav animated:yes];
nav.view.superview.center = cgpointmake(500, 400);//设置中点坐标
[setting_page.navigationcontroller.navigationbar setbackgroundimage:[uiimage imagenamed:@"toubar.png"] forbarmetrics:uibarmetricsdefault];
setting_page.navigationitem.title=@"设置";
[setting_page release];
[barbutton release];
[nav release];
}
//这是主页面button的点击实现函数
-(ibaction)button_touch:(id)sender{
//settingpage是一个newviewcontroller 在此进行初始化
settingpage*setting_page=[[settingpage alloc] initwithnibname:@"settingpage" bundle:nil];
//设定settingpageviewcontroller的rootviewcontroller是uinavigationcontroller(可以任意设置)
uinavigationcontroller *nav = [[uinavigationcontroller alloc]initwithrootviewcontroller:setting_page];
//设置leftbarbutton为完成按钮
uibarbuttonitem *barbutton = [[uibarbuttonitem alloc] initwithtitle:@"完成"
style:uibarbuttonitemstyledone
target:self action:@selector(achieving:)];
setting_page.navigationitem.leftbarbuttonitem = barbutton;
nav.modalinpopover = no;
nav.modalpresentationstyle = uimodalpresentationformsheet;
[self presentmodalviewcontroller:nav animated:yes];
nav.view.superview.center = cgpointmake(500, 400);//设置中点坐标
[setting_page.navigationcontroller.navigationbar setbackgroundimage:[uiimage imagenamed:@"toubar.png"] forbarmetrics:uibarmetricsdefault];
setting_page.navigationitem.title=@"设置";
[setting_page release];
[barbutton release];
[nav release];
}
[cpp]
//完成返回键
-(ibaction)achieving:(id)sender{
[self dismissmodalviewcontrolleranimated:yes];
}
下一篇: 脏读、幻读和不可重复读?为啥?