您的位置:首页 > 其它

杂记

2011-07-26 12:14 134 查看
tableview 的初始化: style:UITableViewStyleGrouped];
tableview = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] bounds] style:UITableViewStyleGrouped];

tableview.delegate = self;
tableview.dataSource = self;

tableview.scrollEnabled = NO;//是否支持滑动。

tableview.backgroundColor = [UIColor clearColor];
tableview.separatorColor = [UIColor grayColor];//分割线的颜色

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"新分组" message:@" \n "
delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Cancel",nil];
UITextField * groupname = [[UITextField alloc] initWithFrame:CGRectMake(30, 50, 220, 30)];
groupname.borderStyle = UITextBorderStyleRoundedRect;
[groupname setBackgroundColor:[UIColor clearColor]];
[groupname becomeFirstResponder];//将软键盘调出来
[alert addSubview:groupname];
[alert show];
[alert release];

软键盘的调出与消失可由UITextFiled的委托方法来处理。

消息的使用:
发送消息
[[NSNotificationCenter defaultCenter] postNotificationName:aName object:nil userInfo:aUserInfo];

注册一个消息:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(changetheme) //消息响应函数
name:ThemeFlag//消息名称
object:nil];

注销一个消息:
[[NSNotificationCenter defaultCenter] removeObserver:self
name:ThemeFlag //消息名称
object:nil];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: