小编Sha*_*hal的帖子

哪种方式更有效?StoryBoard还是XIB?

我的问题与我的标题建议略有不同.我和xib合作过.现在我正在尝试使用故事板.我的问题是,如果我们从另一个类中浏览一个类,那么StoryBoard可以为更好的内存管理带来好处.假设我们有2个ViewControllers:ViewControllerA和ViewControllerB.我们试图通过ViewControllerA - > ViewControllerB.现在,在Xib我们的方法如下;

ViewControllerB *VCB = [ [ViewControllerB alloc] init];
[self.navigationController pushViewController: VCB Animated: YES];
Run Code Online (Sandbox Code Playgroud)

故事板在哪里,

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"Second"])
    {
        SecondViewController *objSecond = (SecondViewController*)[segue destinationViewController];

    }
}
Run Code Online (Sandbox Code Playgroud)

而且,做

[self performSegueWithIdentifier:@"Second" sender:self];
Run Code Online (Sandbox Code Playgroud)

所以,我的问题是我们在Xib中分配我们的类,在storyBoard中我们不是.故事板中是否有任何内存分配优势?

objective-c storyboard xib ios

26
推荐指数
3
解决办法
2万
查看次数

如何在 react-native-webview 中保持最后一个 Web 会话处于活动状态?

我正在开发一个应用程序,在该应用程序中,我需要让用户在react-native-webview.

这是一个必需的工作流程。

  • 我的应用程序只有一个 WebView,正在加载固定 url。

  • 用户将打开应用程序并登录该网站。

  • 当用户将终止应用程序并再次打开它时,我需要让该用户保持登录状态,因为他上次已经登录。

这是我到目前为止尝试过的:

// 列出 cookie(仅限 IOS)

CookieManager.getAll(useWebKit)
    .then((res) => {
        console.log('CookieManager.getAll from webkit-view =>', res);
    });
Run Code Online (Sandbox Code Playgroud)

但正如它所建议的那样,它只能在 iOS 中运行。我也无法在 WebView 中打开的网站中设置该 cookie 以保持该会话处于活动状态。

但我还没有发现任何成功。

任何建议或解决方案将不胜感激。

========更新======

对于安卓:

它默认工作,这意味着我们只需要为 iOS 进行检查。

authentication cookies session react-native react-native-webview

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