2014年9月24日 星期三

Xcode 6.0.1 / iOS 8 UIAlertController

UIAlertControllerStyleAlert with Buttons

UIAlertController  *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleAlert];
   
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel"
style:UIAlertActionStyleCancel
handler:^(UIAlertAction *action)
{
NSLog(@"Cancel Action");
        }];
   
UIAlertAction *deleteAction = [UIAlertAction actionWithTitle:@"Delete"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action)
{
NSLog(@"Delete Action");
}];

[alertController addAction:cancelAction];
[alertController addAction:deleteAction];

[self presentViewController:alertController animated:YES completion:nil];

2014年9月10日 星期三

iOS set UIImageView to CircleView


- (id)imageViewSetCornerRadius:(UIImageView *)imageView withImage:(UIImage *)image {
    
    imageView.image = image;
    imageView.layer.borderWidth = 3.0f;
    imageView.layer.borderColor = [UIColor whiteColor].CGColor;
    imageView.layer.cornerRadius = imageView.frame.size.width / 2;
    imageView.clipsToBounds = YES;
    
    return imageView;
}