iOS 按鈕 Button 高亮不變灰

iOS button 點擊高亮的時候不變灰, 把按鈕類型改爲自定義即可

     _continueBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [_continueBtn setBackgroundImage:[UIImage imageNamed:@"mhsq_history_continue"] forState:UIControlStateNormal];
    [_continueBtn setBackgroundImage:[UIImage imageNamed:@"mhsq_history_continue_h"] forState:UIControlStateHighlighted];

如果類型是 System

    _continueBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    _continueBtn.adjustsImageWhenHighlighted = NO;

或者把圖片設置爲同一張,也行

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章