UISegmentControl

常用方法

  1. 新增一個文字segment
- (void)insertSegmentWithTitle:(nullable NSString *)title atIndex:(NSUInteger)segment animated:(BOOL)animated;
  1. 新增一個圖片segment
- (void)insertSegmentWithImage:(nullable UIImage *)image  atIndex:(NSUInteger)segment animated:(BOOL)animated;
  1. 刪除某個segment
- (void)removeSegmentAtIndex:(NSUInteger)segment animated:(BOOL)animated;
  1. 刪除所有segment
- (void)removeAllSegments;
  1. 設(shè)置某個segment標(biāo)題
- (void)setTitle:(nullable NSString *)title forSegmentAtIndex:(NSUInteger)segment; 
  1. 獲取某個segment標(biāo)題
- (nullable NSString *)titleForSegmentAtIndex:(NSUInteger)segment;
  1. 設(shè)置某個segment圖片
- (void)setImage:(nullable UIImage *)image forSegmentAtIndex:(NSUInteger)segment;  
  1. 獲取某個segment圖片
- (nullable UIImage *)imageForSegmentAtIndex:(NSUInteger)segment;
  1. 設(shè)置某個segment寬度
- (void)setWidth:(CGFloat)width forSegmentAtIndex:(NSUInteger)segment;
  1. 獲取某個segment寬度
- (CGFloat)widthForSegmentAtIndex:(NSUInteger)segment;
  1. 設(shè)置segment內(nèi)容偏移量
- (void)setContentOffset:(CGSize)offset forSegmentAtIndex:(NSUInteger)segment;
  1. 獲取某個segment內(nèi)容偏移量
- (CGSize)contentOffsetForSegmentAtIndex:(NSUInteger)segment;
  1. 設(shè)置某個segment是否可用,默認(rèn)為YES
- (void)setEnabled:(BOOL)enabled forSegmentAtIndex:(NSUInteger)segment;
  1. 獲取某個segment是否可用
- (BOOL)isEnabledForSegmentAtIndex:(NSUInteger)segment;
  1. 設(shè)置背景圖
- (void)setBackgroundImage:(nullable UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics 
  1. 設(shè)置分隔線圖片
   - (void)setDividerImage:(nullable UIImage *)dividerImage forLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0)
  1. 獲取分隔線圖片
- (nullable UIImage *)dividerImageForLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState barMetrics:(UIBarMetrics)barMetrics 
  1. 設(shè)置標(biāo)題富文本屬性
- (void)setTitleTextAttributes:(nullable NSDictionary *)attributes forState:(UIControlState)state NS_AVAILABLE_IOS(5_0)
  1. 獲取富文本屬性
- (void)setTitleTextAttributes:(nullable NSDictionary *)attributes forState:(UIControlState)state NS_AVAILABLE_IOS(5_0)
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 問答題47 /72 常見瀏覽器兼容性問題與解決方案? 參考答案 (1)瀏覽器兼容問題一:不同瀏覽器的標(biāo)簽?zāi)J(rèn)的外補...
    _Yfling閱讀 14,144評論 1 92
  • 1、通過CocoaPods安裝項目名稱項目信息 AFNetworking網(wǎng)絡(luò)請求組件 FMDB本地數(shù)據(jù)庫組件 SD...
    陽明AI閱讀 16,203評論 3 119
  • 在二三十歲甚至十幾歲的時候,我們會去觸碰‘愛情'這個東西,既新奇又小心翼翼。正值年少時光,羞澀的模樣,都是愛情的寫...
    A千樹姑娘閱讀 413評論 0 0
  • 呼出的熱氣遇到玻璃后迅速液化成一層薄薄的水霧,他透窗望去,白茫茫的一片。隱隱作痛的腹部,寒冷的天氣,不停流逝的時間...
    七弦墨閱讀 440評論 0 0
  • 隨著互聯(lián)網(wǎng)+國家戰(zhàn)略的提出,一些嗅覺敏感的企業(yè)紛紛觸網(wǎng),主動或被動的轉(zhuǎn)型升級,酸甜苦辣的滋味,悲歡離合的場面,失敗...
    沃風(fēng)行閱讀 212評論 0 1

友情鏈接更多精彩內(nèi)容