2011-01-28 109 views

回答

56

這個怎麼樣?

UIImage *img = [button imageForState:UIControlStateNormal]; 
+0

感謝Zoul。它的工作。 – Siddiqui 2011-01-28 10:41:34

+0

請問我該如何獲取圖片名稱? – 2017-06-22 11:00:17

0

UIImage *myNewImage = [UIButton imageForState:UIControlStateNormal];

雖然這不是很好的設計實踐。我這樣做:

UIImage *myNewImage = [UIImage imageNamed:@"name of image that is in your bundle"];

1

雨燕3.0語法

let image: UIImage = yourButton.image(for: .normal)!