iOS 开发总结
来源:未知 责任编辑:责任编辑 发表时间:2013-12-01 14:19 点击:次
- (NSString *)URLEncodedString:(NSString *)string{
NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
(CFStringRef)string,NULL,CFSTR("!*'();:@&=+$,/?%#[]"),kCFStringEncodingUTF8);
[result autorelease];
return result;
}
//生成nonce
- (NSString *)generateNonce{
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFStringRef string = CFUUIDCreateString(NULL, theUUID);
NSMakeCollectable(theUUID);
return [(NSString *)string stringByReplacingOccurrencesOfString:@"-" withString:@""];
//return (NSString *)string;
}
//生成Timestamp
- (NSString *)generateTimestamp{
return [[NSString stringWithFormat:@"%d", time(NULL)] retain];
}
iPhone键盘改变颜色
只有这2种数字键盘才有效果:UIKeyboardTypeNumberPad,UIKeyboardTypePhonePad
keyboardAppearance = UIKeyboardAppearanceAlert
代码如下:
NSArray *ws = [[UIApplication sharedApplication] windows];
for(UIView *w in ws){
NSArray *vs = [w subviews];
for(UIView *v in vs){
if([[NSString stringWithUTF8String:object_getClassName(v)] isEqualToString:@"UIKeyboard"]){
v.backgroundColor = [UIColor redColor];
}
}
}
从一个界面push到下一界面左上角返回按钮文字设置
在父viewController中如下设置:
UIBarButtonItem *backbutton = [[UIBarButtonItem alloc]init];
backbutton.title = @"返回列表";
self.navigationItem.backBarButtonItem = backbutton;
[backbutton release];
navigationbar的back键触发其他事件
UIButton *back =[[UIButton alloc] initWithFrame:CGRectMake(200, 25, 63, 30)];
[back addTarget:self action:@selector(reloadRowData:) forControlEvents:UIControlEventTouchUpInside];
[back setImage:[UIImage imageNamed:@"返回按钮.png"] forState:UIControlStateNormal];
UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] initWithCustomView:back];
self.navigationItem.leftBarButtonItem = loginButtonItem
[back release];
[backButtonItem release];
相关新闻>>
- 发表评论
-
- 最新评论 更多>>