好吧,夥計,UIButton with resizable圖片
我知道我做錯了什麼,但我無法弄清楚。這裏是代碼,將 把正常按鈕狀態的可調整大小的圖像。
self.loginButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.loginButton.frame = CGRectMake(0.0, 44.0, 314, 44);
UIImage *image = [[UIImage imageNamed:@"loginbutton_image"] resizableImageWithCapInsets:UIEdgeInsetsMake(0.0,10.0,0.0,10.0)];
[self.loginButton setImage:image forState:UIControlStateNormal];
[self addSubview:self.loginButton];
這裏是圖像
任一圖像的資產是錯誤或代碼。
圖像的寬度爲21px。 右上角的10,& 10左側1Px調整大小。
做任何一個地方我做錯了什麼。
感謝所有通過 阿倫
你確定'image'不是'nil'? – 2012-07-11 01:04:18
是的,我檢查它。都很好。 – 2012-07-11 01:05:39
http://i.imgur.com/jpj1l.png這是它的外觀。 – 2012-07-11 01:05:56