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