你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> iOS 日常記載,小知識點

iOS 日常記載,小知識點

編輯:IOS開發綜合

searchResultsTableView 的contentSize 錯誤問題
//修復 contentSize問題
-(void)searchDisplayController:(UISearchDisplayController *)controller willShowSearchResultsTableView:(UITableView *)tableView
{
    [tableView setContentInset:UIEdgeInsetsZero];
    [tableView setScrollIndicatorInsets:UIEdgeInsetsZero];
}
searchResultsTableView 頁面顯示 無後果
// return YES to reload table. called when search string/option changes. convenience methods on top UISearchBar delegate methods
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString {
    for(UIView *subview in controller.searchResultsTableView.subviews) {
        if([subview isKindOfClass:[UILabel class]]) {
            [(UILabel*)subview setText:@"無後果"];
        }
    }
    return NO;
}
UIButton 文字左對齊
 _locationBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
UIButton 文字和圖片 上下居中陳列
[followBtn setButtonContentAndImageCenter];

-(void)setButtonContentAndImageCenter
{

    CGSize imgViewSize,titleSize,btnSize;

    UIEdgeInsets imageViewEdge,titleEdge;

    CGFloat heightSpace = 10.0f;

    //設置按鈕內邊距
    imgViewSize = self.imageView.bounds.size;
    titleSize = self.titleLabel.bounds.size;
    btnSize = self.bounds.size;
    imageViewEdge = UIEdgeInsetsMake(heightSpace,0.0, btnSize.height -imgViewSize.height - heightSpace, - titleSize.width);

    [self setImageEdgeInsets:imageViewEdge];

    titleEdge = UIEdgeInsetsMake(imgViewSize.height +heightSpace, - imgViewSize.width, 0.0, 0.0);

    [self setTitleEdgeInsets:titleEdge];
}

【iOS 日常記載,小知識點】的相關資料介紹到這裡,希望對您有所幫助! 提示:不會對讀者因本文所帶來的任何損失負責。如果您支持就請把本站添加至收藏夾哦!

  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved