天兒真好鄉親的iOS空Interface Builder的對象
在這種方法...
- (void)configureTableWithTitle:(NSString *)theTitleText about:(NSString *)theAboutText
{
debug(@"configuring with headerText: %@", theTitleText);
debug(@"headerView description: %@", [headerView description]);
debug(@"headerText description: %@", [headerText description]);
CGPoint titleOrigin = headerText.frame.origin;
CGSize titleSize = headerText.frame.size;
[headerText setText:theTitleText];
debug(@"headerText: %@", [headerText text]);
CGSize newTitleSize = [theTitleText sizeWithFont:[headerText font] constrainedToSize:CGSizeMake(titleSize.width, 9999)];
[headerText setFrame:CGRectMake(titleOrigin.x, titleOrigin.y, titleSize.width, newTitleSize.height)];
int titleDelta = newTitleSize.height - titleSize.height;
CGSize titleViewSize = headerView.frame.size;
[headerView setFrame:CGRectMake(0, 0, titleViewSize.width, titleViewSize.height + titleDelta)];
[[self tableView] setTableHeaderView:headerView];
debug(@"footerView description: %@", [footerView description]);
debug(@"footerText description: %@", [footerText description]);
CGPoint aboutOrigin = footerText.frame.origin;
CGSize aboutSize = footerText.frame.size;
[footerText setText:theAboutText];
CGSize newAboutSize = [theAboutText sizeWithFont:[footerText font] constrainedToSize:CGSizeMake(aboutSize.width, 9999)];
[footerText setFrame:CGRectMake(aboutOrigin.x, aboutOrigin.y, aboutSize.width, newAboutSize.height)];
int aboutDelta = newAboutSize.height - aboutSize.height;
CGSize aboutViewSize = footerView.frame.size;
[footerView setFrame:CGRectMake(0, 0, aboutViewSize.width, aboutViewSize.height + aboutDelta)];
[[self tableView] setTableFooterView:footerView];
}
上footerView
& footerText
工作法的線,但那些作用於headerView
& headerText
沒有。這screen shot顯示我有什麼東西掛在IB。 debug
行(Marcus Zarra的NSLog腳本)告訴我,headerView
& headerText
從開始&爲空headerText.text
在嘗試設置文本後爲空。在eader文件中,我有...
@interface MFProgramDetailView : UITableViewController <UITableViewDelegate>
{
UIView *headerView;
UIView *footerView;
UILabel *headerText;
UILabel *footerText;
UITableView *detailTable;
}
@property (nonatomic, retain) IBOutlet UIView *headerView;
@property (nonatomic, retain) IBOutlet UIView *footerView;
@property (nonatomic, retain) IBOutlet UILabel *headerText;
@property (nonatomic, retain) IBOutlet UILabel *footerText;
@property (nonatomic, retain) IBOutlet UITableView *detailTable;
我正在撕裂我的意外。我檢查了&重新檢查&未能看到任何不合適的地方,我已經使用類似的方法與其他課程多次進行了比較(但用項目在標題中玩弄)&看不到區別。
任何人都可以提供任何線索,我如何得到這個錯誤?鑑於這是我已經做了幾次的事,熟悉已經導致失明。
乾杯& TIA, 佩德羅
您是否正在檢查yourTitleText參數以查看該值是什麼? – 2011-12-26 14:37:32
第一條調試線就是這樣,它是預期的文本。 – Pedro 2011-12-26 17:35:30