iOS 小知识点总结

2017-07-01  本文已影响7人  iloverain

在父类中声明方法时:

- (void)functionWith:(NSArray*)arr1 string:(NSString*)string arr:(NSArray*)arr2NS_REQUIRES_SUPER;

子类中实现该父类方法:

- (void)functionWith:(NSArray *)arr1string:(NSString *)stringarr:(NSArray *)arr2 {//不调用super方法,报警告⚠️[superfunctionWith:nilstring:nilarr:nil];}   
func imageCompress(targetWidth:CGFloat) -> UIIMage {
   let targetHeight = targetWidth/width*height
   UIGraphicsBeginImageContext(CGSizeMake(targetWidth,targetHeight))
   self.drawInRect(CGRectMake(0,0,targetWidth,targetHeight))
   let newImage:UIImage = UIGraphicsGetImageFromCurrentImageContext()
            UIGrapicsEndImageContext()
   return newImage
}
上一篇下一篇

猜你喜欢

热点阅读