Я пытаюсь добавить tableView и TextField внутри ModalView. Я делаю это. Я создаю новый View Controller и дать для него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)
Oy, yes it work =) Спасибо много. Можете ли вы помочь мне с небольшой проблемой с моим XCode. Если я редактирую один и тот же файл в стандартном редакторе и в помощнике редактора, он дает мне разные файлы. Но имена файлов одинаковы. И я не могу понять, какой файл будет скомпилирован (( – nabiullinas
Вы уверены, что это те же файлы? Редактор сопутствующих файлов по умолчанию показывает файл '.h' в одном окне и' .m' в другом. –
yes Я уверен, потому что я вижу одно и то же имя файла. Например, когда я нажимаю на файл в решении progect, я вижу одну его версию. Когда я редактирую файл .nib и пользуюсь редактором помощников, я вижу другой ( – nabiullinas