为视图加边框
通过层(layer),可以给视图增加边框和圆角等。比如类似下面的效果: 写法: – (void)loadView { [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation: UIStatusBarAnimationSlide]; UIImageView *contentView = [[MyUIImageView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; [contentView setImage:[UIImage imageNamed:@"1.jpg"]]; [contentView setUserInteractionEnabled:YES]; self.view=[[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; [self.view addSubview:contentView]; self.view.backgroundColor=[UIColor blackColor]; /* CALayer *layer=[contentView layer]; [layer setMasksToBounds:YES]; [layer setCornerRadius:10.0]; [layer [...]