Пожалуйста, дайте предложение этого кодавыборка tabledata в КСНЕ от ONEView контроллера anoher контроллер представления
appdelegate.h
#import <UIKit/UIKit.h>
#import "MainViewController.h"
@interface MainAppDelegate : UIResponder <UIApplicationDelegate>
{
UINavigationController *navigationController;
}
@property (strong, nonatomic) UIWindow *window;
@property (nonatomic, retain) UINavigationController *navigationController;
@property (nonatomic, retain) MainViewController *MainviewController;
appdelegate.m
#import "MainAppDelegate.h"
#import "MainViewController.h"
@implementation MainAppDelegate
@synthesize navigationController, MainviewController;
@synthesize matri;
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[email protected]"";
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.MainviewController = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
self.navigationController = [[UINavigationController alloc] init];
self.window.rootViewController = self.navigationController;
[self.navigationController pushViewController:self.MainviewController animated:YES];
[self.navigationController setNavigationBarHidden:YES animated:NO];
[self.window makeKeyAndVisible];
return YES;
} //plaese provide detail of code
mainviewcontroller.h
#import <UIKit/UIKit.h>
#import "SecViewController.h"
@interface MainViewController : UIViewController <UITableViewDelegate,UITableViewDataSource>
mainviewcontroller.m
#import "MainViewController.h"
#import "MainAppDelegate.h"
@interface MainViewController()
@end
@implementation MainViewController
{
NSArray *tableData;
MainAppDelegate *appDelegate;
}
//@synthesize pun;
- (void)viewDidLoad
{
[super viewDidLoad];
//appDelegate=(MainAppDelegate*)[[UIApplication sharedApplication]delegate ];
tableData = [NSArray arrayWithObjects:@"1",@"2",@"3",@"4", nil];
NSLog(@"tabledata : %@", tableData);
// Do any additional setup after loading the view, typically from a nib.
}
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSLog(@"tabledata : %@", tableData);
return [tableData count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"SimpleTableItem";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
cell.textLabel.text = [tableData objectAtIndex:indexPath.row];
// NSLog(@"Value at index:%@",cell.textLabel.text);
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
SecViewController *SecView = [[SecViewController alloc] initWithNibName:@"SecViewController" bundle:nil];
SecView.newarray =[tableData objectAtIndex:indexPath.row];
[self.navigationController pushViewController:SecView animated:YES ];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
- Я не понимаю, как позвонить econdview с первого взгляда помочь мне
- код дырки файл предназначен для создания простого вида таблицы и вызвать secviewcontroller
- может кто-нибудь помочь мне предоставить код, как позвонить secview объекту и как использовать контроллер MainView
и я также создал nsmutablearray с объектом newarray и синтезировал его. может ли кто-нибудь понять этот код и дать краткое описание этого кода и предложить мне то, что я пропустил, потому что я могу проверить это и вызвать secviewcontroller от mainviewcontroller.
что yourviewcontrolle это первый вид контроллер класс – MeghaJain
кий добавить это, но я не показываю ошибку, loginvc не идентифицируется – MeghaJain
нет я просто добавить, что у написать мое имя вида – MeghaJain