❶ IOS開發button點擊之後有高亮效果,效果一直保留,點擊下一個按鈕高亮效果轉移。
你初始化時給幾個btn設定4個值, 普通狀態時:文字顏色,圖片狀態 高亮時:文字顏色,圖片狀態
然後設定第一個btn的selected = YES;
在點擊事件里處理時,點擊的btn.selected = YES; 然後你去拿2另外2個btn,設他們的selected屬性為NO
❷ iOS for循環創建button 如何綁定隨機背景
根據button的tag來識別button,用setbackgroundimage來設置背景圖片,將圖片名稱放到plist中,用隨機函數獲取圖片名稱
❸ button 背景圖片無法鋪滿整個按鈕,求解決……
<button style="background:url(../images/first.gif)">首頁</button>
❹ ios 仿好友的好友動態背景圖怎麼實現的
工具
編程軟體工具;
藍色的背景圖片;
操作步驟
首先先把背景圖設置為 UIButton 的背景圖片;
❺ ios開發 為什麼該段代碼無法改變圖片的背景圖
第一個問題 設定button類型為自定義的 默認系統的 不可以改變背景圖片
[UIButton buttonWithType:UIButtonTypeCustom];
第二個問題 我不知道你是怎麼初始化button 你初始化button的時候 給了它frame了么 可能是因為[UIButton appearance]這個方法吧
❻ 蘋果開燈壁紙怎麼設置 蘋果ios開燈壁紙怎麼弄
第一步、點擊打開「設置」選項。
第二步、找到「牆紙與亮度」,點擊進入。
第三步、點擊「選取牆紙」下面的圖片。
第四步、在牆紙選取選項中,可以選擇蘋果的內置壁紙,也可以選取手機相冊中的圖片。
第五步、其中官方內置壁紙又分為動態和靜態壁紙,這里以先選擇動態壁紙為例,點擊「動態壁紙」選項。
第六步、系統內置了七款動態壁紙,選擇自己喜歡的動態壁紙。
第七步、隨後會在底部彈出「設定」按鈕,點擊設定按鈕。
第八步、在壁紙設置里有三個選項,從上到下分別是:
1,設定鎖定屏–即鎖屏界面的壁紙。
2,設定主屏–即解鎖後在主屏上看到的背景圖片。
3,同時設定–即同時把這張壁紙設定為鎖定和主屏壁紙。
4,以設定為鎖定屏為例,點擊「設定為鎖定屏」選項。
第九步、設定好以後,按電源鍵鎖定iPhone6,再打開屏幕即可看到鎖屏壁紙已經變成了動態壁紙了。
❼ ios 有三個button,點擊任意一個button,這個三個button的背景圖片都會改變,一會就又變回去
三個全局的按鈕,點擊的時候更換背景圖片,同時開一個nstimer到時間再還原回去,比較笨的方法
❽ ui怎麼設置button被選中後的背景顏色
1,通過按鈕的事件來設置背景色
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *button1 = [[UIButton alloc] initWithFrame:CGRectMake(50, 200, 100, 50)];
[button1 setTitle:@"button1" forState:UIControlStateNormal];
button1.backgroundColor = [UIColor orangeColor];
[button1 addTarget:self action:@selector(button1BackGroundHighlighted:) forControlEvents:UIControlEventTouchDown];
[button1 addTarget:self action:@selector(button1BackGroundNormal:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button1];
}
// button1普通狀態下的背景色
- (void)button1BackGroundNormal:(UIButton *)sender
{
sender.backgroundColor = [UIColor orangeColor];
}
// button1高亮狀態下的背景色
- (void)button1BackGroundHighlighted:(UIButton *)sender
{
sender.backgroundColor = [UIColor greenColor];
}
2,通過把顏色轉換為UIImage來作為按鈕不同狀態下的背景圖片
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *button2 = [[UIButton alloc] initWithFrame:CGRectMake(170, 200, 100, 50)];
[button2 setTitle:@"button2" forState:UIControlStateNormal];
[button2 setBackgroundImage:[self imageWithColor:[UIColor redColor]] forState:UIControlStateNormal];
[button2 setBackgroundImage:[self imageWithColor:[UIColor grayColor]] forState:UIControlStateHighlighted];
[self.view addSubview:button2];
}
// 顏色轉換為背景圖片
- (UIImage *)imageWithColor:(UIColor *)color {
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *image = ();
UIGraphicsEndImageContext();
return image;
}