标签: segue

iOS:获取分段TableView中的行位置

是否能够在prepareForSegue方法中的分段表视图中访问选定的行位置?

这是我的Segue代码:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{

if ([[segue identifier] isEqualToString:@"CurrentEvent"]) {

    Tab1_DetailTableViewController *vc = [segue destinationViewController];

    // get the selected index
    NSInteger selectedIndex = [[self.tableView indexPathForSelectedRow] row];

}
}
Run Code Online (Sandbox Code Playgroud)

我查找了几种直接访问位置的方法,但我找不到一个.我想我已经监督了一些事情.有人知道吗?

position uitableview ios segue

8
推荐指数
1
解决办法
7307
查看次数

Xcode自定义segue - 封面垂直对面(从上到下) - COMPLETE NEWBIE

我已经尝试了一段时间来创建一个与封面垂直相反的自定义segue(创建一个从上到下的效果动画).我查看了其他问题,google和youtube但是无法让它工作.我是这是一个全新的课程等,所以任何步骤指南或视频的帮助都会很好.我相信这个URL正在尝试做类似于我想要的事情:

http://jrwren.wrenfam.com/blog/2012/02/01/storyboard-custom-segue-for-custom-pushviewcontroller-animation/,我无法让它发挥作用.

如果你们中的任何人都知道如何创建一个segue的顶部到底部版本的segue你可以帮助我吗?

xcode segue

8
推荐指数
1
解决办法
9404
查看次数

尝试从动态UITableViewCell执行popover segue时编译错误

我正在尝试使用popover segue将动态UITableViewCell连接到故事板中的导航控制器.
为此,我从单元格拖动到导航控制器,选择"popover"作为segue,然后为其分配一个标识符.以这种方式,segue的锚点成为细胞.

使用此配置,我从编译器中收到此错误:

Couldn't compile connection: <IBCocoaTouchOutletConnection:0x40114c920  <IBProxyObject: 0x40114c540> => anchorView => <IBUITableViewCell: 0x4012576c0>>
Run Code Online (Sandbox Code Playgroud)

我想要做的只是每次选择一个单元格时打开一个弹出控制器.如果我尝试做同样的事情但指定另一种segue(推或模态......)没有错误.我已经尝试从头开始创建一个新的示例项目,只包含所需的组件,但错误仍然存​​在.

谢谢阅读.

在此输入图像描述

在此输入图像描述

storyboard uitableview ios segue

8
推荐指数
2
解决办法
3791
查看次数

制作按钮UIAlertView执行Segue

我创建了UIAlertView一个动作,它给了我两个选项.我希望用户能够点击按钮并让它执行Segue.

这是我到目前为止的代码:

- (IBAction)switchView:(id)sender
{
    UIAlertView *myAlert = [[UIAlertView alloc]
                            initWithTitle:@"Please Note"
                            message:@"Hello this is my message"
                            delegate:self
                            cancelButtonTitle:@"OK"
                            otherButtonTitles:@"Option 1", @"Option 2", nil];
    [myAlert show];
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    NSString *buttonTitle = [alertView buttonTitleAtIndex:buttonIndex];

    if ([buttonTitle isEqualToString:@"Option 1"]) {



    }
}
Run Code Online (Sandbox Code Playgroud)

uialertview ios uistoryboard segue uistoryboardsegue

8
推荐指数
2
解决办法
5929
查看次数

UIViewController半屏"抽屉幻灯片"动画

我试图让UIViewController右边的"幻灯片"动画出现.不像Push segue,不像Facebook应用程序.我希望新的ViewController在当前的一个上滑动(不要将它推开),但只覆盖屏幕的PART,而另一部分则显示第一个ViewController.

我尝试过的:我得到的最接近的是创建一个具有以下内容的自定义segue:

- (void)perform
{
    __block UIViewController *src = (UIViewController *) self.sourceViewController;
    __block UIViewController *dst = (UIViewController *) self.destinationViewController;

    CATransition* transition = [CATransition animation];
    transition.duration = .50;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionMoveIn;
    transition.subtype = kCATransitionFromRight;

    [src.navigationController.view.layer addAnimation:transition forKey:@"SwitchToView1"];
    [src.navigationController pushViewController:dst animated:NO];
}
Run Code Online (Sandbox Code Playgroud)

这实现了我想要的动画,但它涵盖了整个第一个ViewController.我怎么能让它停在某一点而不是覆盖整个事物?

我正在使用Storyboards,这是我第一次尝试任何类型的新动画.

storyboard uiviewcontroller uiviewanimation ios segue

8
推荐指数
2
解决办法
8655
查看次数

iOS7故事板图像选择器无法正常工作:(

我试图imagePicker使用故事板在一个新的iOS7 Xcode项目中设置,但在我找到以下代码之前似乎无法在线找到任何示例.

我已经设置好了,当按下按钮时,它会使用模态推送物体导航到视图,该视图的类"UIImagePickerController"显然在图像选择器代码中调用.

但是,当应用程序运行时,点击后允许应用程序访问您的照片,任何获得一些帮助的机会都不会加载任何内容吗?

错误屏幕截图抓取: https ://pbs.twimg.com/media/Bdy7v9JCAAABpvS.jpg : large

界面设置:

@interface ridecount_AddRide_ViewController : UIViewController<UIImagePickerControllerDelegate, UINavigationControllerDelegate>{
Run Code Online (Sandbox Code Playgroud)

码:

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    UIImagePickerController *controller = [segue destinationViewController];
    controller.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    controller.delegate = self;
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
    [self dismissViewControllerAnimated:YES completion:nil];
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
    [self dismissViewControllerAnimated:YES completion:nil];
    UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
    [[self.view viewWithTag:100023] removeFromSuperview];
    UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(320/2-200/2, 10, 100, 100)];
    imageView.tag = 100023;
    imageView.contentMode = UIViewContentModeScaleAspectFit;
    imageView.image = image;
    [self.view addSubview:imageView];
}
Run Code Online (Sandbox Code Playgroud)

image objective-c storyboard ios segue

8
推荐指数
1
解决办法
1946
查看次数

在swift中将数据从一个选项卡控制器传递到另一个

我的应用程序有三个与tabBar三个tab关联的viewController.我想从第一个选项卡切换到第三个选项卡,并将一些数据从第一个视图控制器传递到第三个视图控制器.我不能用segue来做,因为segue在所选标签内创建导航.那不是我的要求.我想在tabBar中切换选项卡并传递一些数据而不进行任何导航.我该怎么做 ?

uiviewcontroller uitabbar ios segue swift

8
推荐指数
2
解决办法
7414
查看次数

如何从第一个选项卡中切换到标签栏控制器的第二个选项卡?

我没有问题实际执行segue,但是当我这样做时,我的标签栏从视图的底部消失.我已经从TabBarController1到TabBarController2创建了一个故事板segue.

我已经为Objective-C找到了很多答案,但没有为Swift找到答案.

这是执行segue的代码:

if requestsArray.count == 0 {
                self.performSegueWithIdentifier("offerSegue", sender: self)
            } else {
                self.performSegueWithIdentifier("confirm1", sender: self)
            }
Run Code Online (Sandbox Code Playgroud)

ios segue swift

8
推荐指数
2
解决办法
9954
查看次数

从Modal/Popover中解除Segue导致对开始/结束外观转换的不平衡调用

我有以下设置:

导航控制器 - > VC1 -Push - > VC2 -PopOver或Modal Segue - > VC3.

VC3正在退回到VC1.

当从VC2到VC3的Segue是PopOver和Modal时,unwind以警告结束:UIViewController的开始/结束外观转换的不平衡调用"

如果推动从VC到VC的Segue,则警告消失.

在此输入图像描述 任何想法如何摆脱警告或为什么它甚至显示?

storyboard uiviewcontroller ios segue

8
推荐指数
1
解决办法
907
查看次数

第一次点击按钮时不播放segue的自定义动画

我遇到了一个不寻常的行为,我被卡住了一点,问题如下.

我正在使用BWWalkthrough库,以便将4张幻灯片作为启动画面.所以在我的appdelegate中,我有以下代码初始化viewcontrollers:

let storyboard = UIStoryboard(name: "SlidesFlow", bundle: nil)

let walkthrough = storyboard.instantiateViewController(withIdentifier: "SlidesView") as! BWWalkthroughViewController
let page_zero = storyboard.instantiateViewController(withIdentifier: "page_1")
let page_one = storyboard.instantiateViewController(withIdentifier: "page_2")
let page_two = storyboard.instantiateViewController(withIdentifier: "page_3")
let page_three = storyboard.instantiateViewController(withIdentifier: "page_4")

walkthrough.delegate = self
walkthrough.addViewController(page_zero)
walkthrough.addViewController(page_one)
walkthrough.addViewController(page_two)
walkthrough.addViewController(page_three)
Run Code Online (Sandbox Code Playgroud)

一切都按预期工作,所以这里没问题.在viewController page_three上我有一个按钮,使用自定义segue动画将我重定向到另一个视图控制器

class sentSegueFromRight: UIStoryboardSegue {

override func perform()
{
    let src = self.source as UIViewController
    let dst = self.destination as UIViewController

    src.view.superview?.insertSubview(dst.view, aboveSubview: src.view)
    dst.view.transform = CGAffineTransform(translationX: src.view.frame.size.width, y: 0)

    UIView.animate(withDuration: 0.25,
                               delay: 0.0,
                               options: UIViewAnimationOptions.curveEaseInOut, …
Run Code Online (Sandbox Code Playgroud)

ios segue uistoryboardsegue swift3 xcode8

8
推荐指数
1
解决办法
112
查看次数