Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 无法在故事板之间切换_Ios_Objective C_Segue - Fatal编程技术网

Ios 无法在故事板之间切换

Ios 无法在故事板之间切换,ios,objective-c,segue,Ios,Objective C,Segue,所以我找到了一个很好的提纲,给了我想要的。但是,我不能切换到其他故事板 #import "ViewController.h" @interface ViewController () @end #define getDataURL @"http://??.??.??.??/phpfile12.php" @implementation ViewController @synthesize

所以我找到了一个很好的提纲,给了我想要的。但是,我不能切换到其他故事板

   #import "ViewController.h"        

        @interface ViewController ()

        @end

        #define getDataURL @"http://??.??.??.??/phpfile12.php"

        @implementation ViewController
        @synthesize json, storesArray, myTableView;
        - (void)viewDidLoad
        {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.




    self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};


    [self.navigationController.navigationBar setBackgroundImage:[UIImage new]
                                                  forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage = [UIImage new];
    self.navigationController.navigationBar.translucent = YES;
    self.navigationController.view.backgroundColor = [UIColor clearColor];

    //set the title
    self.title = @"";

    [self retrieveData];
        }


        - (void)didReceiveMemoryWarning
        {
            [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
        }

        #pragma mark - UITableView Datasource

        - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
        }

        - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return storesArray.count;
        }

        - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:        (NSIndexPath *)indexPath {
            static NSString *cellIdentifier = @"Cell";

            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];

            if(cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
    }

    //cell.textLabel.text = [NSString stringWithFormat:@"Cell %d", indexPath.row];

    //Retrieve the current city object for use with this indexPath.row
    Store * currentStore = [storesArray objectAtIndex:indexPath.row];

    cell.textLabel.text = currentStore.storeName;
    cell.detailTextLabel.text = currentStore.storeAddress;
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    return cell;
        }

        #pragma mark - UITableView Delegate methods

        - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
        {
            DetailViewController * dvc = [[DetailViewController alloc]init];

    //Retrieve the current selected city
    Store * currentStore = [storesArray objectAtIndex:indexPath.row];
    dvc.name = currentStore.storeName;
    dvc.address = currentStore.storeAddress;
    dvc.startDate = currentStore.storeStartDate;
    dvc.endDate = currentStore.storeEndDate;
    dvc.startTime = currentStore.storeStartTime;
    dvc.endTime = currentStore.storeEndTime;
    dvc.totalSales = currentStore.storeTotalSales;
    dvc.voids = currentStore.storeVoids;
    dvc.discounts = currentStore.storeDiscounts;
    dvc.guestCount = currentStore.storeGuestCount;
    dvc.peopleServed = currentStore.storePeopleServed;
    dvc.employeeClockIn = currentStore.storeEmployeeClockIn;


    [self.navigationController pushViewController:dvc animated:YES];
        }


        #pragma mark - Methods
        - (void) retrieveData
        {
    NSURL * url = [NSURL URLWithString:getDataURL];
    NSData * data = [NSData dataWithContentsOfURL:url];

            json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];



            //Set up our cities array
            storesArray = [[NSMutableArray alloc]init];

            for (int i = 0; i < json.count; i++)
            {
                //Create city object
        NSString * sID = [[json objectAtIndex:i] objectForKey:@"id"];
        NSString * sAddress = [[json objectAtIndex:i] objectForKey:@"storeAddress"];
        NSString * sName = [[json objectAtIndex:i] objectForKey:@"storeName"];
        NSString * sStartDate = [[json objectAtIndex:i] objectForKey:@"storeStartDate"];
        NSString * sStartTime = [[json objectAtIndex:i] objectForKey:@"storeStartTime"];
        NSString * sEndDate = [[json objectAtIndex:i] objectForKey:@"storeEndDate"];
        NSString * sEndTime = [[json objectAtIndex:i] objectForKey:@"storeEndTime"];
        NSString * sTotalSales = [[json objectAtIndex:i] objectForKey:@"storeTotalSales"];
        NSString * sVoids = [[json objectAtIndex:i] objectForKey:@"storeVoids"];
        NSString * sDiscounts = [[json objectAtIndex:i] objectForKey:@"storeDiscounts"];
        NSString * sGuestCount = [[json objectAtIndex:i] objectForKey:@"storeGuestCount"];
        NSString * sPeopleServed = [[json objectAtIndex:i] objectForKey:@"storePeopleServed"];
        NSString * sEmployeeClockIn = [[json objectAtIndex:i] objectForKey:@"storeClockIn"];




                Store * myStore = [[Store alloc]initWithStoreID: (NSString *) sID andStoreName: (NSString *) sName andStoreStartDate: (NSString *) sStartDate andStoreStartTime: (NSString *) sStartTime andStoreEndDate: (NSString *) sEndDate andStoreEndTime: (NSString *) sEndTime andStoreTotalSales: (NSString *) sTotalSales andStoreVoids: (NSString *) sVoids andStoreDiscounts: (NSString *) sDiscounts andStoreGuestCount: (NSString *) sGuestCount andStorePeopleServed: (NSString *) sPeopleServed andStoreEmployeeClockIn: (NSString *) sEmployeeClockIn andStoreAddress: (NSString *) sAddress];

                //Add our city object to our cities array
                [storesArray addObject:myStore];
            }




            [self.myTableView reloadData];


        }

    @end
如何使用“内置”窗口切换到其他故事板

包括我的ViewController.M实现文件。这段代码似乎是自己创建一个表,而不是使用故事板(导航控制器)

我如何让它工作到其他故事板

   #import "ViewController.h"        

        @interface ViewController ()

        @end

        #define getDataURL @"http://??.??.??.??/phpfile12.php"

        @implementation ViewController
        @synthesize json, storesArray, myTableView;
        - (void)viewDidLoad
        {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.




    self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};


    [self.navigationController.navigationBar setBackgroundImage:[UIImage new]
                                                  forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage = [UIImage new];
    self.navigationController.navigationBar.translucent = YES;
    self.navigationController.view.backgroundColor = [UIColor clearColor];

    //set the title
    self.title = @"";

    [self retrieveData];
        }


        - (void)didReceiveMemoryWarning
        {
            [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
        }

        #pragma mark - UITableView Datasource

        - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
        }

        - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return storesArray.count;
        }

        - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:        (NSIndexPath *)indexPath {
            static NSString *cellIdentifier = @"Cell";

            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];

            if(cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
    }

    //cell.textLabel.text = [NSString stringWithFormat:@"Cell %d", indexPath.row];

    //Retrieve the current city object for use with this indexPath.row
    Store * currentStore = [storesArray objectAtIndex:indexPath.row];

    cell.textLabel.text = currentStore.storeName;
    cell.detailTextLabel.text = currentStore.storeAddress;
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    return cell;
        }

        #pragma mark - UITableView Delegate methods

        - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
        {
            DetailViewController * dvc = [[DetailViewController alloc]init];

    //Retrieve the current selected city
    Store * currentStore = [storesArray objectAtIndex:indexPath.row];
    dvc.name = currentStore.storeName;
    dvc.address = currentStore.storeAddress;
    dvc.startDate = currentStore.storeStartDate;
    dvc.endDate = currentStore.storeEndDate;
    dvc.startTime = currentStore.storeStartTime;
    dvc.endTime = currentStore.storeEndTime;
    dvc.totalSales = currentStore.storeTotalSales;
    dvc.voids = currentStore.storeVoids;
    dvc.discounts = currentStore.storeDiscounts;
    dvc.guestCount = currentStore.storeGuestCount;
    dvc.peopleServed = currentStore.storePeopleServed;
    dvc.employeeClockIn = currentStore.storeEmployeeClockIn;


    [self.navigationController pushViewController:dvc animated:YES];
        }


        #pragma mark - Methods
        - (void) retrieveData
        {
    NSURL * url = [NSURL URLWithString:getDataURL];
    NSData * data = [NSData dataWithContentsOfURL:url];

            json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];



            //Set up our cities array
            storesArray = [[NSMutableArray alloc]init];

            for (int i = 0; i < json.count; i++)
            {
                //Create city object
        NSString * sID = [[json objectAtIndex:i] objectForKey:@"id"];
        NSString * sAddress = [[json objectAtIndex:i] objectForKey:@"storeAddress"];
        NSString * sName = [[json objectAtIndex:i] objectForKey:@"storeName"];
        NSString * sStartDate = [[json objectAtIndex:i] objectForKey:@"storeStartDate"];
        NSString * sStartTime = [[json objectAtIndex:i] objectForKey:@"storeStartTime"];
        NSString * sEndDate = [[json objectAtIndex:i] objectForKey:@"storeEndDate"];
        NSString * sEndTime = [[json objectAtIndex:i] objectForKey:@"storeEndTime"];
        NSString * sTotalSales = [[json objectAtIndex:i] objectForKey:@"storeTotalSales"];
        NSString * sVoids = [[json objectAtIndex:i] objectForKey:@"storeVoids"];
        NSString * sDiscounts = [[json objectAtIndex:i] objectForKey:@"storeDiscounts"];
        NSString * sGuestCount = [[json objectAtIndex:i] objectForKey:@"storeGuestCount"];
        NSString * sPeopleServed = [[json objectAtIndex:i] objectForKey:@"storePeopleServed"];
        NSString * sEmployeeClockIn = [[json objectAtIndex:i] objectForKey:@"storeClockIn"];




                Store * myStore = [[Store alloc]initWithStoreID: (NSString *) sID andStoreName: (NSString *) sName andStoreStartDate: (NSString *) sStartDate andStoreStartTime: (NSString *) sStartTime andStoreEndDate: (NSString *) sEndDate andStoreEndTime: (NSString *) sEndTime andStoreTotalSales: (NSString *) sTotalSales andStoreVoids: (NSString *) sVoids andStoreDiscounts: (NSString *) sDiscounts andStoreGuestCount: (NSString *) sGuestCount andStorePeopleServed: (NSString *) sPeopleServed andStoreEmployeeClockIn: (NSString *) sEmployeeClockIn andStoreAddress: (NSString *) sAddress];

                //Add our city object to our cities array
                [storesArray addObject:myStore];
            }




            [self.myTableView reloadData];


        }

    @end
#导入“ViewController.h”
@界面视图控制器()
@结束
#定义getDataURL@“http:///phpfile12.php”
@实现视图控制器
@合成json、storesArray、myTableView;
-(无效)viewDidLoad
{
[超级视图下载];
//加载视图后,通常从nib执行任何其他设置。
self.navigationController.navigationBar.titleTextAttributes=@{NSForegroundColorAttributeName:[UIColor whiteColor]};
[self.navigationController.navigationBar setBackgroundImage:[UIImage新建]
forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.shadowImage=[UIImage new];
self.navigationController.navigationBar.translucent=是;
self.navigationController.view.backgroundColor=[UIColor clearColor];
//设置标题
self.title=@;
[自检索数据];
}
-(无效)未收到记忆警告
{
[超级记忆警告];
//处置所有可以重新创建的资源。
}
#pragma标记-UITableView数据源
-(NSInteger)表格视图中的节数:(UITableView*)表格视图{
返回1;
}
-(NSInteger)表视图:(UITableView*)表视图行数节:(NSInteger)节{
return storesArray.count;
}
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{
静态NSString*cellIdentifier=@“Cell”;
UITableViewCell*单元格=[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
如果(单元格==nil){
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle重用标识符:cellIdentifier];
}
//cell.textLabel.text=[NSString stringWithFormat:@“cell%d”,indexPath.row];
//检索当前城市对象以用于此indexPath.row
Store*currentStore=[storesArray objectAtIndex:indexath.row];
cell.textlab.text=currentStore.storeName;
cell.detailTextLabel.text=currentStore.storeAddress;
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
返回单元;
}
#pragma标记-UITableView委托方法
-(void)tableView:(UITableView*)tableView未选择RowatineXpath:(NSIndexPath*)indexPath
{
DetailViewController*dvc=[[DetailViewController alloc]init];
//检索当前选定的城市
Store*currentStore=[storesArray objectAtIndex:indexath.row];
dvc.name=currentStore.storeName;
dvc.address=currentStore.storeAddress;
dvc.startDate=currentStore.storeStartDate;
dvc.endDate=currentStore.storeEndDate;
dvc.startTime=currentStore.storeStartTime;
dvc.endTime=currentStore.storeEndTime;
dvc.totalSales=currentStore.storeTotalSales;
dvc.voids=currentStore.storeVoids;
dvc.折扣=currentStore.Store折扣;
dvc.guestCount=currentStore.storeGuestCount;
dvc.peopleServed=currentStore.storePeopleServed;
dvc.employeeClockIn=currentStore.storeEmployeeClockIn;
[self.navigationController pushview控制器:dvc动画:是];
}
#pragma标记-方法
-(无效)检索数据
{
NSURL*url=[NSURL URLWithString:getDataURL];
NSData*data=[NSData dataWithContentsOfURL:url];
json=[NSJSONSerialization JSONObjectWithData:数据选项:kNilOptions错误:nil];
//建立我们的城市阵列
storesArray=[[NSMutableArray alloc]init];
for(int i=0;iUIViewController *dvc = [[UIStoryboard storyboardWithName:@"yourStoryboardName" bundle:nil] instantiateViewControllerWithIdentifier:@"yourViewIdentifier"];
[self.navigationController pushViewController:dvc animated:YES];
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *initViewController = [storyboard instantiateViewControllerWithIdentifier:@"SecondScreen"];
delegate.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
delegate.window.rootViewController = initViewController;
[delegate.window makeKeyAndVisible];