加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

iOS - 设置Cookie

(2014-05-13 17:42:51)
标签:

ios-设置cookie

it

调整uipickerview文字

分类: Mac/IOS那些事

-(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;

 

}

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有