如何使一页将消息传递给另一页? [英] How to make one page pass on a message to another?

查看:49
本文介绍了如何使一页将消息传递给另一页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是,不同的用户将有权使用不同的产品.假设用户1可以访问3,而用户2可以访问所有4.

My problem is different users will have access to different products. Say User 1 has access to 3 whereas User 2 has access to all 4.

我可以在登录时输入一些信息,如果用户1登录,它将告诉MainView仅显示3个单元格?类似于MainView中的ViewDidLoad来读取登录页面回显的内容?

Can I have something upon Login where if User 1 logs in, it will tell the MainView to only show 3 cells? Something like ViewDidLoad in the MainView to read what the Login Page echo-ed?

可以做到吗?

谢谢.

推荐答案

将全局变量存储在 appdelegate 中,例如 numberOfCells .根据您的登录条件为其分配值.

Store a global variable in appdelegate like numberOfCells. Assign value to it by the condition of your login.

一旦您的MainView即将像在viewWillAppear中那样显示,请从 appdelegate 获取 numberOfCells 的值并更改UI.

Once your MainView is about to display like in viewWillAppear, get the value of numberOfCells from appdelegate and chage your UI.

您可以按以下方式获取appdelegate参考.

You can get the appdelegate reference as follows.

SampleAppDelegate *appdelegate=(SampleAppDelegate*)[[UIApplication sharedApplication] delegate];

这篇关于如何使一页将消息传递给另一页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆