day 019 UITextField UIAlertView UIActionSheet
来源:互联网 发布:小说 知乎 编辑:程序博客网 时间:2024/05/29 17:17
// ViewController.h
// UITextFiled
//
// Created by 蔡定龙 on 15-4-12.
// Copyright (c) 2015年 李灵杰. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController<UITextFieldDelegate,UIAlertViewDelegate,UIActionSheetDelegate>
@end
//
// ViewController.m
// UITextFiled
//
// Created by 蔡定龙 on 15-4-12.
// Copyright (c) 2015年 李灵杰. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
UITextField *singerTextField = [[UITextField alloc]initWithFrame:CGRectMake(10, 50, 300, 50)];
[singerTextField setBorderStyle:UITextBorderStyleLine];
[singerTextField setBackgroundColor:[UIColor grayColor]];
//[singerTextField setPlaceholder:@"please input singer's name"];
[singerTextField setTextColor:[UIColor blueColor]];
[singerTextField setTextAlignment:NSTextAlignmentCenter];
//[singerTextField setText:@"say hi"];
[singerTextField setKeyboardType:UIKeyboardTypeNumbersAndPunctuation];
//设置代理为本身
singerTextField.delegate = self;
//设置安全输入
singerTextField.secureTextEntry = YES;
[self.view addSubview:singerTextField];
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"软件评分" message:@"请给五分好评" delegate:self cancelButtonTitle:@"再见" otherButtonTitles:@"5分不谢",@"3分够了",@"1分惭愧", nil];
//alertView.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput;
//弹出警告视图
//[alertView show];
//[alertView h]
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"share" delegate:nil cancelButtonTitle:@"xinlangweibo" destructiveButtonTitle:@"tengxunweibo" otherButtonTitles:@"csdn",@"qqkongjian", nil];
//[actionSheet showInView:self.view];
UIProgressView *progressView = [[UIProgressView alloc]initWithFrame:CGRectMake(50, 100, 220, 100)];
progressView.progress = 0.5;
// progressView.progressViewStyle =
//[self.view addSubview:progressView];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark --- UITextFieldDelegate
//return被按下,就会来执行这个方法
/*
Bool yes 可以响应return的按键操作
no 不可以响应
*/
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
/*
隐藏键盘
第一响应者
取消第一响应者
*/
[textField resignFirstResponder];//quxiao
//[textField becomeFirstResponder];//chengwei
return YES;
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
NSLog(@"replace String %@",string);
NSLog(@"text is %@",textField.text);
return YES;
}
#pragma mark --- UIAlert
//当某个按钮被按下之后就回调这个方法
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex==1) {
NSLog(@"1");
}else{
NSLog(@"other");
}
}
#pragma mark --- UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 0) {
NSLog(@"0");
}else{
if (buttonIndex==1) {
NSLog(@"1");
}else{
NSLog(@"other");
}
}
}
@end
- day 019 UITextField UIAlertView UIActionSheet
- UIAlertview UIActionSheet
- UIAlertView&UIActionSheet
- UIAlertView、UIActionSheet
- UIAlertView、UIActionSheet
- UIAlertView,UIActionSheet, UIMenuController
- UIAlertView vs UIActionSheet
- UIActionSheet与UIAlertView
- UIActionSheet与UIAlertView
- UIActionSheet与UIAlertView
- UIAlertView、UIActionSheet兼容iOS8
- UIActionSheet与UIAlertView
- IOS-UIAlertView和UIActionSheet
- UIActionSheet和UIAlertView
- UIAlertView和UIActionSheet
- UIAlertView,UIActionSheet的使用
- UIAlertView和UIActionSheet
- UIActionSheet and UIAlertView
- 学生干部管理系统的现状分析和可行性分析
- [Practical.Vim(2012.9)].Drew.Neil.Tip50 学习摘要
- 虚析构函数作用
- Hibernate学习笔记(二)深入Hibernate的配置文件
- Android Push Notification技术实现
- day 019 UITextField UIAlertView UIActionSheet
- 看了看书
- UIView和CALayer的区别 说的比较清楚了
- mysql的limit优化
- 函数指针学习2
- 自写字符串连接函数strcat
- python 实现选择排序
- Posts Tagged 【dfs】 Combinations
- /proc/$PID/status