有時(shí)會(huì)遇到得到的圖片/圖標(biāo)的大小不是很貼合需求,這時(shí)最好找美工,也可以自行重繪
UIImage *icon = [UIImage imageNamed:@"rili.png"]; CGSize itemSize = CGSizeMake(20, 20); //重繪圖標(biāo),設(shè)置大小 UIGraphicsBeginImageContextWithOptions(itemSize, NO, 0.0); CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height); [icon drawInRect:imageRect]; [button setImage:UIGraphicsGetImageFromCurrentImageContext() forState:UIControlStateNormal]; UIGraphicsEndImageContext(); //這里一定要關(guān)閉可用于所有的image屬性
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注