【发布时间】:2016-04-27 16:20:21
【问题描述】:
我使用的库在 Objective-c 中有一个 xib 文件
我的故事板有 swift 类
我需要从那个 xib 文件创建 segue 到我的故事板并传递一些数据。
试过了,没有运气
XIB 文件
#import "IncomingMessageCell.h"
@implementation IncomingMessageCell
- (void)awakeFromNib {
UIImage * balloonImage = [UIImage imageNamed:@"bubble-left"];
balloonImage = [balloonImage resizableImageWithCapInsets:(UIEdgeInsets){36, 32, 18, 12}];
self.bubbleView.image = balloonImage;
self.avatarView.layer.cornerRadius = 25;
self.avatarView.clipsToBounds = YES;
self.avatarView.userInteractionEnabled = YES;
UITapGestureRecognizer *tapGesture1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGesture:)];
tapGesture1.numberOfTapsRequired = 1;
[tapGesture1 setDelegate:self];
[self.avatarView addGestureRecognizer:tapGesture1];
}
- (void) tapGesture: (id)sender
{
UIViewController *vc = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:@"yourVcIdentifier"];
[self.navigationController pushViewController:vc animated:YES];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
这怎么可能?
【问题讨论】:
-
你在哪里试试这个?你现在的 VC 是什么?
-
我更新了我的问题
-
那么当你点击时会发生什么?
-
无法构建我在“IncomingMessageCell *”类型的对象上找不到属性“navigationController”错误
-
我看到 IncomingMessageCell 不是 UIVIewController 类型。您需要有一个代表来保存对导航控制器的引用。 IncomingMessageCell 是如何创建的?
标签: ios objective-c segue xib