码迷,mamicode.com
首页 > 移动开发 > 详细

IOS开发的一些小技巧

时间:2014-08-13 12:24:56      阅读:250      评论:0      收藏:0      [点我收藏+]

标签:style   http   color   os   io   for   ar   art   

 将图片写入模拟器相册

   UIImageWriteToSavedPhotosAlbum([UIImage imageNamed:@"call"], nil, nil, nil);

 

-------------------------------------------------------------------------------------------------------------------    

    UIView* uiViewBuildingAddress=[[UIViewalloc]initWithFrame:self.view.frame];

    uiViewBuildingAddress.backgroundColor=[UIColorblackColor];

    //父视图不影响子视图背景色

    uiViewBuildingAddress.backgroundColor=[UIColorcolorWithWhite:0

                                                           alpha:0.6];

-------------------------------------------------------------------------------------------------------------------    

 

#pragma mark - 获取view从属的viewController

- (UIViewController*)getViewController

{

    for (UIView* next = [selfsuperview]; next; next = next.superview)

    {

        UIResponder* nextResponder = [next nextResponder];

        if ([nextResponderisKindOfClass:[UIViewControllerclass]])

        {

            

            return (UIViewController*)nextResponder;

        }

    }

    return nil;

}

-------------------------------------------------------------------------------------------------------------------    

避免Block的Retain Cycle

 

            NSURL* nsUrlBindIngHouse=[NSURLURLWithString:[NSStringstringWithFormat:@"%@%@",WEBSERVICE_URL,PersonalCenter_BindIngHouse_HouseList]];

          __block ASIHTTPRequest* asiHTTPRequestBindIngHouse=[ASIHTTPRequestrequestWithURL:nsUrlBindIngHouse];

            __weak ASIHTTPRequest* asiHTTPRequestBindIngHouse2=asiHTTPRequestBindIngHouse;

            

             [asiHTTPRequestBindIngHouse2 setCompletionBlock:^

            {

            }];

            

            [asiHTTPRequestBindIngHouse2 setFailedBlock:^

            {

                NSLog(@"asiHTTPRequestBindIngHouse2.error:%@",asiHTTPRequestBindIngHouse2.error);

            }];

            [asiHTTPRequestBindIngHouse2 startAsynchronous];

 

-------------------------------------------------------------------------------------------------------------------    

 

IOS开发的一些小技巧,布布扣,bubuko.com

IOS开发的一些小技巧

标签:style   http   color   os   io   for   ar   art   

原文地址:http://www.cnblogs.com/louyizhidu/p/3909329.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!