正如标题所示,我希望能够锁定除了一个标签栏之外的所有标签栏.只有在用户完成操作后,才会启用其余所有标签栏.我怎样才能做到这一点?
我在标签栏应用程序上工作.
在所有视图tabbar中进行.好.
但在一个特定的视图中,我不想显示我的tabbar.
当我将视图推到下一个视图时,标签栏也会进入该视图.
当我试图隐藏它时,它显示该视图的空白区域.
怎么办..提前thnaks
我的故事板中有一个标签栏和5个标签.
我希望我的应用程序加载到中间选项卡,但我找不到如何做到这一点以及在哪里做.
我有一个像这样的UITabBarController:
/*SomeTabBarController.h*/
@interface SomeTabBarController: UITabBarController
@end
Run Code Online (Sandbox Code Playgroud)
在SomeTabBarController.m中我想更改viewDidLoad上的活动选项卡
-(void)viewDidLoad
{
[super viewDidLoad];
self.tabBarController.selectedIndex = 2;
}
Run Code Online (Sandbox Code Playgroud)
但是,tabBarController是零.我错过了什么?我有一个导航控制器和segue推送到标签栏控制器...
谢谢
我正在应用程序后显示图像didFinishLaunchingWithOptions,应用程序包含在标签栏中,在第一个视图中我有一些按钮.用户只能在按下第一张图像中的按钮后才能继续使用该应用程序,问题是,某些用户可以与标签栏进行交互,并且第一个视图中的按钮甚至包含图像.如何完全禁用这些按钮和tabBar中的用户交互,然后仅在按下按钮并且图像消失时启用?
我正在使用标签栏,我有2个颜色问题.
第一个问题,色调颜色为灰色,我使用了一些代码将其更改为白色但仅在按下选项卡时才变为白色.
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let barColor = UIColor(red: 49/255, green: 75/255, blue: 108/255, alpha: 1.0)
let pressedTintColor = UIColor.whiteColor()
UITabBar.appearance().barTintColor = barColor
UITabBar.appearance().tintColor = pressedTintColor
return true
}
Run Code Online (Sandbox Code Playgroud)
第二个问题,按下的标签的背景颜色应该改变,但它没有改变.
(第1张图片在Xcode Simulator中就像测试一样,第2张图片就是它的设计,因此对图片和标签文字的重要性并不重要)
因此,假设所有选项卡始终为白色,并且当按下选项卡时仅更改选项卡的背景颜色.
根据我的功能,我需要使用抽屉菜单和底部导航。我正在使用https://github.com/roughike/BottomBar进行底部导航。
如果我使用只有 3 个选项卡的底部导航,它可以正常工作,但如果我使用 4 或 5 个选项卡扩展它,它会在工具栏顶部出现空白。
这是我用于添加底部导航的代码片段。
活动_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/DrawerLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" android:elevation="7dp" android:fitsSystemWindows="false" android:scrollbars="none">
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
<include android:id="@+id/tool_bar" layout="@layout/row_main_toolbar_header"></include>
<!-- The main content view -->
<FrameLayout android:id="@+id/contentFrame" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginBottom="@dimen/dp_1" android:layout_marginTop="@dimen/dp_10" android:background="@android:color/white" android:orientation="vertical"></FrameLayout>
</LinearLayout>
<ListView android:id="@+id/lvDrawerMenu" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="start" android:background="@android:color/white" android:scrollbars="none"></ListView>
</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)
使用给定库进行底部导航不需要任何组件。
在 MainActivity.java 中添加底部导航。
BottomBar bottomBar = BottomBar.attach(this, savedInstanceState);
bottomBar.setItemsFromMenu(R.menu.home_tab_menu, new OnMenuTabSelectedListener() {
@Override
public void onMenuItemSelected(int itemId) {
switch (itemId) {
case R.id.recent_item:
break;
case …Run Code Online (Sandbox Code Playgroud) 我在故事板中创建了一个简单的标签栏,其中有三个视图.标签栏效果很好,但是当我尝试通过选项卡中的按钮显示另一个视图控制器时,新视图将放置在整个屏幕上以及标签栏上.
这是我按下按钮时到目前为止呈现视图的方式:
@IBAction func buttonPressed(_ sender: UIButton) {
let newVC = self.storyboard?.instantiateViewController(withIdentifier: "extraVC")
self.present(newVC!, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
我的另一个想法是:
self.tabBarController?.present(vc!, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
但令我惊讶的是,这也没有用.
那么如何在标签栏中显示另一个视图控制器(以便仍然显示底部栏)?
在用户将应用程序的外观从亮模式更改为暗模式后,我试图重新加载选项卡栏,反之亦然。我可以更新应用程序中除选项卡栏以外的所有内容。我不想强迫用户关闭应用程序。
tabbar ×10
ios ×5
swift ×3
iphone ×2
objective-c ×2
uitabbar ×2
android ×1
appbar ×1
flutter ×1
navigation ×1
storyboard ×1
uibutton ×1
uiimageview ×1
uiview ×1
whitespace ×1
xcode ×1
xcode7 ×1