-(void)writeCookie{
NSArray *keys = [NSArray arrayWithObjects:
NSHTTPCookieSecure,
NSHTTPCookieDomain,
NSHTTPCookieExpires,
NSHTTPCookieName,
NSHTTPCookiePath,
NSHTTPCookieValue,nil];
NSArray *objects = [NSArray arrayWithObjects:
@"TRUE",
@".chinapet.com",
[[NSDate date] initWithTimeIntervalSinceNow:86500],
@"auth",
@"/webpath/",
@"ohes",nil];
NSDictionary *dict = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
NSHTTPCookie *cookieA = [NSHTTPCookie cookieWithProperties:dict];
NSHTTPCookieStorage *sharedHTTPCookie = [NSHTTPCookieStorage
sharedHTTPCookieStorage];
[sharedHTTPCookie setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
[sharedHTTPCookie
setCookie:cookieA];
NSLog(@"写入后:%@",[[NSHTTPCookieStorage
sharedHTTPCookieStorage]cookies]);
}
原文地址:http://www.cocoachina.com/bbs/read.php?tid=53355
#pragma mark ---
调整 UIPickerView文字得大小
NSString *selectString =
nil;
- (UIView
*)pickerView:(UIPickerView
*)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component
reusingView:(UIView *)view{
if (component ==0) {
selectRow
= row;
[pickerView selectRow:0 inComponent:1 animated:YES]; //这里重新加载
可以让两行同事滚动,不崩溃
[pickerView reloadComponent:1];
selectString
=
[self.mainClubArray objectAtIndex:row];
}else if
(component == 1){
selectString = [[[self.clubPlistArray objectAtIndex:selectRow]objectAtIndex:row] objectForKey:@"name"];
}
UILabel* pickerLabel = (UILabel*)view;
if (!pickerLabel){
pickerLabel = [[UILabel alloc] init];
pickerLabel.adjustsFontSizeToFitWidth = YES;
pickerLabel.textAlignment = NSTextAlignmentCenter ;
[pickerLabel
setBackgroundColor:[UIColor
clearColor]];
[pickerLabel setFont:[UIFont fontWithName:nil size:17.0f]];
}
pickerLabel.text=selectString;
return pickerLabel;
}
加载中,请稍候......