私は、ModalViewの中にtableViewとTextFieldを追加しようとしています。私はそうする。私は、新しいビューコントローラを作成し、それをTable View ControllerとTextField Inside ModalView
#import <UIKit/UIKit.h>
@protocol UYLModalViewControllerDelegate
-(void) buttonDonePassed :(NSArray *) variables;
@end
@interface UYLModalViewController : UIViewController <UITableViewDelegate>
{
id<UYLModalViewControllerDelegate> delegate;
IBOutlet UITableView *tblView;
IBOutlet UITextField *textField;
NSMutableArray *cellsArray;
//UITextField *textField;
}
@property (nonatomic, assign) id<UYLModalViewControllerDelegate> delegate;
@property (nonatomic, retain) IBOutlet UITableView *tblView;
@property (retain, nonatomic) IBOutlet UITextField *textField;
@end
を与えるとの.mファイルに私は機能
#pragma mark -
#pragma mark Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [cellsArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = [cellsArray objectAtIndex:indexPath.row];
// Configure the cell.
return cell;
}
とViewDidiLoad
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(buttonPassed:)];
//UITableView *tableView = [[UITableView alloc] init];
//[self]
cellsArray = [[NSMutableArray alloc] initWithObjects:@"one",@"two",@"three", nil];
[tblView reloadData];
}
を作成しかし、私のプログラムはTableViewDelegateに行っていませんメソッド(cellforrowAtIndexPathなど)
オイ、そうです=)ありがとうございます。あなたは私のXCodeにほとんど問題なく私を助けることができますか?スタンドアロンエディタとアシスタントエディタで同じファイルを編集すると、別のファイルが表示されます。しかし、ファイルの名前は同じです。そして、私はどのファイルがコンパイルされるのか理解できません(( – nabiullinas
あなたはそれらが同じファイルであることを確かめていますか?)コンパニオンエディタはデフォルトで、あるウィンドウに '.h'ファイルを表示し、もう一つのウィンドウに' .m'を表示します。 –
yes私はファイルの同じ名前を見るので、私は確信しています。例えば、私はprogectソリューションでファイルをクリックすると、その1つのバージョンを参照してください.nibファイルを編集し、アシスタントエディタを使用すると私は別のを参照してください( – nabiullinas