我想將tableview放入tableview單元格中。我喜歡它給出的格式化外觀。我希望能夠放入幾個字段,例如姓名,電子郵件等。我錯過了什麼可以完成這項工作?目前我無法將「ProfileCell」設置爲tableview類。TableViewCell中的TableView
在配置文件電池我加我的.h文件中:
@interface ProfileCell : UITableViewCell <UITableViewDataSource,UITableViewDelegate>
,在我的.m文件我加了一些實現代碼如下基本方法:
#import "ProfileCell.h"
@implementation ProfileCell
- (void)awakeFromNib {
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Number of rows is the number of time zones in the region for the specified section.
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"Doing this");
static NSString *MyIdentifier = @"MyReuseIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
return cell;
}
@end
編輯:
我哈哈已經分隔爲cellview實現代碼如下代碼到它自己的文件和鏈接的tableview這一類,但它不看火:
@interface ProfileBasicDetails : UITableView <UITableViewDataSource,UITableViewDelegate>
每評論下面
這是我的頁面應該看起來像說完了。這是因爲用戶可以輸入他們的細節,同時看起來不錯和格式化,但沒有貧民窟的樣子。
文檔中有一個隱藏的警告:*您不應該在UIScrollView對象中嵌入UIWebView或UITableView對象。如果這樣做,可能會導致意外的行爲,因爲兩個對象的觸摸事件可能會混淆並被錯誤地處理。*作爲UIScrollView的子視圖,這適用於此:不要這樣做。它有效或不可能:這是意想不到的行爲。 https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWebView_Class/#//apple_ref/doc/uid/TP40006950-CH3-DontLinkElementID_5 – vikingosegundo
謝謝。你知道,即使它被鎖定,它是否仍然重要?我不打算滾動那個,只是讓它格式化輸入的項目,就像你在其他應用程序中看到的一樣。 – LeviXC
您需要訪問源代碼才能回答此問題。我沒有那個。 – vikingosegundo