UI UI基本控件
来源:互联网 发布:nginx 图片加载不出来 编辑:程序博客网 时间:2024/05/03 22:19
//// VisionAppDelegate.m// UI基本空间// Copyright (c) 2014年 Vision. All rights reserved.//#import "VisionAppDelegate.h"@implementation VisionAppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(30, 30, 280, 60)]; label.backgroundColor = [UIColor redColor]; [self.window addSubview:label]; //label的属性设置 //显示的文本信息 label.text = @"显示的文本信息"; //文本颜色 label.textColor = [UIColor yellowColor]; //文本阴影颜色 label.shadowColor = [UIColor blueColor]; //文本阴影偏移量 label.shadowOffset = CGSizeMake(3, 3); //文本格式处理(对齐方式) label.textAlignment = NSTextAlignmentCenter; //当文本过长时, label显示的断行方式 label.lineBreakMode = NSLineBreakByTruncatingHead; //控制label显示的行数 label.numberOfLines = 0; //系统默认字体大小17 label.font = [UIFont systemFontOfSize:20];// label.font = [UIFont fontWithName:[[UIFont familyNames]objectAtIndex:25] size:19]; label.tag = 10; [label release]; //UITextFied UITextField *name = [[UITextField alloc]initWithFrame:CGRectMake(30,100, 280, 30)]; //默认的占位字符串 一旦输入 自动隐藏 name.placeholder = @"请在这里输入"; //输入控制 //输入转换为黑点 name.secureTextEntry = YES; //更改键盘类型 name.keyboardType = UIKeyboardTypeASCIICapable; //外观控制 name.borderStyle = UITextBorderStyleRoundedRect; //给textField设置tag name.tag = 100; //清除按钮 name.clearButtonMode = UITextFieldViewModeWhileEditing; name.backgroundColor = [UIColor clearColor]; [self.window addSubview:name]; [name release]; //UIButton UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; button.frame = CGRectMake(30, 140, 280, 30); [button setTitle:@"千万别点击我" forState:UIControlStateNormal]; //点击的时候设置button的高亮 button.showsTouchWhenHighlighted = YES; //给按钮绑定一个方法,点击的时候 让某个特定的对象调用这个方法 //参数1:执行方法的对象 //参数2:要执行的方法(参数1的对象去执行) //参数3:按钮让绑定的对象调用方法,需要触发的事件 [button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside]; button.backgroundColor = [UIColor blueColor]; [self.window addSubview:button]; [_window release]; return YES;}//给按钮点击设定方法- (void)buttonClicked:(UIButton *)button{ self.window.backgroundColor = [UIColor clearColor]; NSLog(@"被点击了"); //让键盘回收 //1.找到弹出键盘的textField(通过设置tag) UITextField *textField = (UITextField *)[self.window viewWithTag:100]; //2.回收键盘 [textField resignFirstResponder]; UILabel *label = (UILabel *)[self.window viewWithTag:10]; label.text = @"我滴天"; //UIAlertView的使用 UIAlertView *alertview = [[UIAlertView alloc]initWithTitle:@"提示" message:@"我不是告诉你不要点击了么,我就问你后悔不后悔?" delegate:self cancelButtonTitle:@"我只是手抖." otherButtonTitles:@"就要点",@"就要点",@"就要点",@"就要点",@"就要点",@"就要点"@"吓尿了", nil]; [alertview show]; [alertview release];}- (void)dealloc{ [_window release]; [super dealloc];}
0 0
- UI UI基本控件
- UI初级--UI基本控件
- UI基本控件
- iOS 基本UI控件
- UI基本控件
- UI基本三控件
- UI基本控件
- UI基本控件---UITextField
- Android-基本UI控件
- android UI基本控件
- Android 基本UI控件
- UI基本控件
- WebDriver_Java基本UI控件操作
- IOS之基本UI控件
- IOS之基本UI控件
- object-UI之基本控件
- Android 讲解:基本UI 控件
- iOS基本UI控件总结
- Struts 2与DWR 整合
- ]联系人号码后面7位相同,如保存A:15801234567,拨打15901234567匹配不到A的这类问题的处理方法
- spoj 375 树链剖分模板
- ubuntu 终端显示路径太长
- Berkeley套接字的一些基本知识
- UI UI基本控件
- 几种线程池的实现算法分析
- php int 类型长度是有限制的
- 研磨设计模式之适配器模式(Adapter)-场景问题
- 关于memset函数的用法
- E-R图示例(2 工厂管理)
- android 画圆环表示收益所占比重
- java实现 数据结构之8大排序
- web service(SOAP)与HTTP接口的区别