Pages

Wednesday, October 06, 2010

[iOS] ทำ UIButton แบบมีรูป background

สำหรับ background ใส่ title ได้
[button setBackgroundImage:[UIImage imageNamed:@"selected_button.png"] forState:UIControlStateNormal];

สำหรับรูปปุ่ม (ไม่สามารถใส่ title ได้)
[button setImage:[UIImage imageNamed:@"selected_button.png"] forState:UIControlStateNormal];