IOS开发的一些小技巧

 将图片写入模拟器相册

   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开发的一些小技巧,,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。