UI3_ViewController初步
//
// AppDelegate.m
// UI3_ViewController初步
//
// Created by zhangxueming on 15/6/30.
// Copyright (c) 2015年 zhangxueming. All rights reserved.
// #import "AppDelegate.h" @interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
//视图控制器
//包含视图部分及控制部分
//通过视图控制器管理视图
NSLog(@"rootViewController = %@", self.window.rootViewController);
self.window.backgroundColor = [UIColor cyanColor];
return YES;
}
//
// ViewController.m
// UI3_ViewController初步
//
// Created by zhangxueming on 15/6/30.
// Copyright (c) 2015年 zhangxueming. All rights reserved.
// #import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:YES];
CGRect rect = CGRectMake(20,100, self.view.frame.size.width-40, self.view.frame.size.height-200);
self.view.frame = rect;
NSLog(@"view = %@", self.view);
} - (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
CGRect rect = CGRectMake(20,100, self.view.frame.size.width-40, self.view.frame.size.height-200);
self.view.frame = rect; self.view.backgroundColor = [UIColor redColor]; UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
[btn setTitle:@"点击我" forState:UIControlStateNormal];
[btn setTitle:@"背景颜色被修改" forState:UIControlStateHighlighted];
btn.frame = CGRectMake(20,100, self.view.frame.size.width-40, 50);
btn.backgroundColor = [UIColor yellowColor];
[btn addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
btn.tag = 100;
[self.view addSubview:btn]; UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeSystem];
[btn1 setTitle:@"点击我" forState:UIControlStateNormal];
[btn1 setTitle:@"背景颜色被修改" forState:UIControlStateHighlighted];
btn1.frame = CGRectMake(20,200, self.view.frame.size.width-40, 50);
btn1.backgroundColor = [UIColor yellowColor];
[btn1 addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
btn1.tag = 101;
[self.view addSubview:btn1];
} - (void)btnClicked:(UIButton *)btn
{
if (btn.tag==100) {
self.view.backgroundColor = [UIColor purpleColor];
}
else if (btn.tag==101)
{
self.view.backgroundColor = [UIColor blueColor];
}
} - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end
UI3_ViewController初步的更多相关文章
- 移动端之Android开发的几种方式的初步体验
目前越来越多的移动端混合开发方式,下面列举的大多数我都略微的尝试过,就初步的认识写个简单的心得: 开发方式 开发环境 是否需要AndroidSDK 支持跨平台 开发语言&技能 MUI Win+ ...
- CSharpGL(29)初步封装Texture和Framebuffer
+BIT祝威+悄悄在此留下版了个权的信息说: CSharpGL(29)初步封装Texture和Framebuffer +BIT祝威+悄悄在此留下版了个权的信息说: Texture和Framebuffe ...
- Android自定义View初步
经过上一篇的介绍,大家对于自定义View一定有了一定的认识,接下来我们就以实现一个图片下显示文字的自定义View来练习一下.废话不多说,下面进入我们的正题,首先看一下我们的思路,1.我们需要通过在va ...
- 初步认识Node 之Node为何物
很多人即便是在使用了Node之后也不知道它到底是什么,阅读完本文你应该会有一个初步的.具体的概念了. Node的目标 提供一种简单的构建可伸缩网络程序的方法.那么,什么是可伸缩网络程序呢?可伸缩 ...
- [入门级] 基于 visual studio 2010 mvc4 的图书管理系统开发初步 (二)
[入门级] 基于 visual studio 2010 mvc4 的图书管理系统开发初步 (二) Date 周六 10 一月 2015 By 钟谢伟 Category website develop ...
- 基于C/S架构的3D对战网络游戏C++框架_05搭建系统开发环境与Boost智能指针、内存池初步了解
本系列博客主要是以对战游戏为背景介绍3D对战网络游戏常用的开发技术以及C++高级编程技巧,有了这些知识,就可以开发出中小型游戏项目或3D工业仿真项目. 笔者将分为以下三个部分向大家介绍(每日更新): ...
- Azure底层架构的初步分析
之所以要写这样的一篇博文的目的是对于大多数搞IT的人来说,一般都会对这个topic很感兴趣,因为底层架构直接关乎到一个公有云平台的performance,其实最主要的原因是我们的客户对此也非常感兴趣, ...
- CozyRSS开发记录14-RSS源管理初步完工
CozyRSS开发记录14-RSS源管理初步完工 1.添加源的响应 DialogHost.Show有几个版本的重载,加一个DialogClosingEventHandler参数.我们让添加源对话框的添 ...
- 初步了解CPU
了解CPU By JackKing_defier 首先说明一下,本文内容主要是简单说明CPU的大致原理,所需要的前提知识我会提出,但是由于篇幅我不会再详细讲解需要的其他基础知识.默认学过工科基础课. ...
随机推荐
- Qt Quick实现的涂鸦程序
之前一直以为 Qt Quick 里 Canvas 才干够自绘.后来发觉不是,原来还有好几种方式都能够画图! 能够使用原始的 OpenGL(Qt Quick 使用 OpenGL 渲染).能够构造QSGN ...
- 在编辑模式中一个ASP.NET应用详细视图显示集合属性 编辑模式和只读模式
https://documentation.devexpress.com/#Xaf/CustomDocument3230
- 使用贝赛尔曲线画扇形、圆形、弧线、多边形,实现App下载时的动画效果demo
// // MyView.swift // TestUIBezierPath // // Created by iCodeWoods on 16/5/8. // Copyright © 2016年 i ...
- shell 编程中使用到得if语句内判断参数
http://blog.chinaunix.net/uid/21411227/cid-63616-list-1.html 1.判断文件类型 –b 当file存在并且是块文件时返回真 -c 当fil ...
- php 运行客户提交代码(攻击)和运行图片中的代码
1.$a=@strrev(ecalper_gerp);$b=@strrev(edoced_46esab);@$a($b(L3h4L2Ug),$_POST[POST],bxxb); 2.<?php ...
- 判断null
var tmp = this.pullDown.getValue(); if(!tmp && typeof(tmp)!="undefined" &&am ...
- 数据结构之平衡二叉树(AVL)
一:平衡二叉树特点:平衡二叉树(Balanced binary tree)是由阿德尔森-维尔斯和兰迪斯(Adelson-Velskii and Landis)于1962年首先提出的,所以又称为AVL树 ...
- Asp.Net处理URL空格变%20问题
在Web前端需要页面跳转的时候我们可能会这样子用:window.location.href = "page.html?parameters",如果刚好parameters里面带有空 ...
- main方法无法编译
main方法无法编译,可能是没有括号的原因
- c++ 设计模式7 (Bridge 桥模式)
4.2 Bridge 桥模式 动机: 由于某些类型的固有的实现逻辑,使得它们具有两个变化的维度,乃至多个变化的维度. 代码示例: 实现一个Messager,含有基本功能PlaySound,Connec ...