点击ParcelPickUpViewController
xib中的按钮后,我想转到LocationDetailsTableViewCell
。但是我已经编写了下面的代码并且能够运行。但结果根本不会发生。需要有关此问题的帮助。谢谢。
在LocationDetailsTableViewCell.h
@property (nonatomic, strong) UINavigationController *viewController;
在LocationDetailsTableViewCell.m
- (IBAction)selectBtn:(id)sender {
UIStoryboard *mainStoryBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ParcelPickUpViewController *vc = [mainStoryBoard instantiateViewControllerWithIdentifier: @ "pickUpVC"];
[self.viewController pushViewController:vc animated: YES];
[self.viewController setNavigationBarHidden:YES animated:YES];
}
答案 0 :(得分:0)
试试这个...
UIStoryboard *mainStoryBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ParcelPickUpViewController *vc = [mainStoryBoard instantiateViewControllerWithIdentifier: @ "pickUpVC"];
self.viewController = [[UINavigationController alloc] init];
[self.viewController pushViewController:vc animated: YES];
[self.viewController setNavigationBarHidden:YES animated:YES];
选项2
您创建的导航控制器未分配实例导航控制器的内存,因此请执行
setNavigationBarHidden
如果您不需要 UIStoryboard *mainStoryBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ParcelPickUpViewController *vc = [mainStoryBoard instantiateViewControllerWithIdentifier: @ "pickUpVC"];
[self presentViewController:vc animated:YES completion:nil];
,那么请使用
选项3
gpsbabel -i gpx -f blah.gpx -x transform,wpt=trk,del -o gpx -F converted.gpx
答案 1 :(得分:0)
我认为您在UITableViewCell中有按钮。现在您想从按钮点击导航到下一个视图。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CustomCell";
CustomCell *cell = (CustomCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil) {
NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:nil options:nil];
cell = [nibObjects objectAtIndex:0];
}
cell.btnSelct.tag = indexPath.row;
[cell.btnSelct addTarget:self action:@selector(selectBtn:) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
- (IBAction)selectBtn:(id)sender
{
//This is for XIB
ParcelPickUpViewController *vc = [[ParcelPickUpViewController alloc]initWithNibName:@"pickUpVC" bundle:nil];
//If you use storyboard
UIStoryboard *mainStoryBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ParcelPickUpViewController *vc = [mainStoryBoard instantiateViewControllerWithIdentifier: @"parcelpickup"];
[self.viewController pushViewController:vc animated: YES];
}
答案 2 :(得分:0)
(1)确保在isInitialViewController
中设置storyboard
(应用启动时要显示的第一个控制器)。
(2)如果您未在UINavigationController
中添加storyboard
,请将其设为programeticaly,并将其设为rootViewController
,并将其设置为InitialViewController
in didFinishLaunchingWithOptions
app delegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
UIStoryboard *storyboard = storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:Nil];
UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"Your_First_View_Controller_Identifier"];
UINavigationController *rootNavigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
self.window.rootViewController = rootNavigationController;
return YES;
}
。
ParcelPickUpViewController
(3)导航到- (IBAction)selectBtn:(id)sender {
ParcelPickUpViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier: @ "pickUpVC"];
[self.navigationController pushViewController:vc animated: YES];
}
只需添加以下代码:
0 04:41
1 05:35
1 05:40
0 06:34
0 06:51
1 07:45
1 15:21
0 16:15