<div class="iteye-blog-content-contain" style="font-size: 14px"></div>// ViewController.m
// Reservation software
//
// Created by 张亚雄 on 15/6/2.
// Copyright (c) 2015年 张亚雄. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// 本项目。导航栏。 头文字
self.navigationItem.title = @"订餐";
//本项目,导航控制器背景颜色设置为黑色
[self.navigationController.navigationBar setBarTintColor:[UIColor blackColor]];
//本项目,导航控制器标题文字颜色
[self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];
//调取整体长宽高
double width = self.view.frame.size.width;
//设置button按钮
[self create_button: width :@selector(order_button_pressed: ) :100 :@"帮订餐"];
[self create_button: width :@selector(look_up_ordered_restaurant:) :150 :@"看订餐"];
//设置button按钮颜色。
UIViewController *viewController = [[UIViewController alloc]init];
viewController.view.backgroundColor = [UIColor whiteColor];
//push到子页页面
[self.navigationController pushViewController:viewController animated:YES];}
//设置各个button边框。
- (UIButton *)create_button : (double)width : (SEL)btn_pressed : (double)y : (NSString * )title
{
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
[button setTitle:title forState:UIControlStateNormal];
[button addTarget:self action:btn_pressed forControlEvents:UIControlEventTouchUpInside];
button.frame = CGRectMake(width/8,y , 3*width/4, 35);
button.layer.borderWidth = 1.0;
button.layer.borderColor = [UIColor grayColor].CGColor;
button.layer.cornerRadius = 10.0;
[self.view addSubview:button];
return button;
}
//设置button源
-(void)order_button_pressed:(id)sender
{
UIViewController *viewController = [[UIViewController alloc]init];
viewController.view.backgroundColor = [UIColor whiteColor];
[self.navigationController pushViewController:viewController animated:YES];
}
//设置button源
- (void)look_up_ordered_restaurant : (id)sender
{
UIViewController *viewController = [[UIViewController alloc]init];
viewController.view.backgroundColor = [UIColor whiteColor];
[self.navigationController pushViewController:viewController animated:YES];
}
@end
- 大小: 26.9 KB
分享到:
相关推荐
Change NavigationBar's color and transparency 导航栏颜色渐变,通过给viewController添加属性,可方便控制title、item、导航栏颜色变化
导航控制器presentViewController,导航控制器presentViewController的实现。
ViewController.m
0代码实现viewcontroller 使viewcontroller更干净
实现两个viewcontroller之间的界面切换,有动画效果
集中管理 VC 的 方法类 集中管理 VC 的 方法类集中管理 VC 的 方法类集中管理 VC 的 方法类集中管理 VC 的 方法类集中管理 VC 的 方法类集中管理 VC 的 方法类集中管理 VC 的 方法类
IOS父ViewController为竖屏,presentViewController强制旋转为横屏
ios实现viewcontroller切换传值的三种方法
通脱截图做背景的方式实现玻璃效果模糊显示一个ViewController,
iOS之presentViewController模态全屏适配解决方案.docx
Swift自定义presentViewController的转场动画
实现类似于Facebook的滑动和滚动拉消失的Viewcontroller
viewController的跳转动画
iOS7和iOS8 开发中presentViewController: 不覆盖原先的 viewController界面的方法
oc ViewController show
NULL 博文链接:https://stephen830.iteye.com/blog/2243853
ViewController.swift