gpt4 book ai didi

ios推送到navigationController以黑屏结束

转载 作者:行者123 更新时间:2023-11-29 03:15:58 26 4
gpt4 key购买 nike

我尝试通过其在线文档将 stripe 实现到 iOS 应用程序中。到目前为止一切都很好,现在将 paymentView 推到我的导航 Controller 堆栈上,我得到一个完全损坏的屏幕。认为这是条纹 View 的问题但是当我没有登录时(见下面的代码 - 没有给出识别 token )并且正在推送登录屏幕,它也完全是黑色的。这不会是该 View 的问题,因为如果我从另一个 View 推送登录 View 在此 View 之前,它加载得很好。

那么为什么通过下面的 buyButtonAction 推送 View 会给我黑屏/搞砸的屏幕?!我已经研究了几个小时了......似乎没有任何效果。

图片:

ios stripe view

the important code part:

@interface PaymentViewController ()

@end

@implementation PaymentViewController

@synthesize stripeCard = _stripeCard;
@synthesize stripeView;
@synthesize passedProductId;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}

- (void)viewDidLoad
{


[super viewDidLoad];
// Do any additional setup after loading the view.
self.stripeView = [[STPView alloc] initWithFrame:CGRectMake(15,20,290,55)
andKey:@"pk_test_45mqixOu8N9S4lQ6cdn1OXBD"];
self.stripeView.delegate = self;
[self.view addSubview:self.stripeView];

}

还有电话:

-(void)buyButtonAction:(id)sender
{
tokenClass *tokenObject = [tokenClass getInstance];
NSLog(@"%@", tokenObject.token);
if (tokenObject.token == nil) {
LoginController *loginController = [[LoginController alloc] init];
[self.navigationController pushViewController:loginController animated:YES];
} else {
NSLog(@"%@", tokenObject.token);
CGPoint hitPoint = [sender convertPoint:CGPointZero toView:self.tableView];
NSIndexPath *hitIndex = [self.tableView indexPathForRowAtPoint:hitPoint];
PaymentViewController *payView = [[PaymentViewController alloc] init];
payView.passedProductId = [[self.productData valueForKey:@"id"] objectAtIndex:hitIndex.row];
NSLog(@"passing %@", payView.passedProductId);
// push payment view
payView.navigationItem.title = @"One-Click-Payment";
[self.navigationController pushViewController:payView animated:YES];
}
}

最佳答案

我们可以看到导航栏后面有一个 View 。这是一个与 iOS 7 相关的问题。将此行添加到您的 viewDidLoad:

 if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
self.edgesForExtendedLayout = UIRectEdgeNone;

或者通过将 64 添加到 y 来更改您的 self.stripeView 框架:

CGRectMake(15,84,290,55)



有用链接:https://stackoverflow.com/a/18103727/1835155

关于ios推送到navigationController以黑屏结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21710220/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com