如何在设置为False

时间:2015-06-02 11:07:48

标签: ios

我禁用tabBar项目然后栏按钮变为灰色。

我想改变它的颜色但是无法做到。默认为灰色。

当我setEnabled为true时,它显示原始颜色为白色。

[[[[self.tabBarController tabBar]items]objectAtIndex:0]setEnabled:FALSE];

2 个答案:

答案 0 :(得分:1)

我在// Original version of this file was part of InterClient 2.01 examples // // Copyright InterBase Software Corporation, 1998. // Written by com.inprise.interbase.interclient.r&d.PaulOstler :-) // // Code was modified by Roman Rokytskyy to show that Firebird JCA-JDBC driver // does not introduce additional complexity in normal driver usage scenario. // // An example of using a JDBC 2 Standard Extension DataSource. // The DataSource facility provides an alternative to the JDBC DriverManager, // essentially duplicating all of the driver manager’s useful functionality. // Although, both mechanisms may be used by the same application if desired, // JavaSoft encourages developers to regard the DriverManager as a legacy // feature of the JDBC API. // Applications should use the DataSource API whenever possible. // A JDBC implementation that is accessed via the DataSource API is not // automatically registered with the DriverManager. // The DriverManager, Driver, and DriverPropertyInfo interfaces // may be deprecated in the future. public final class DataSourceExample { static public void main (String args[]) throws Exception { // Create an Firebird data source manually; org.firebirdsql.pool.FBWrappingDataSource dataSource = new org.firebirdsql.pool.FBWrappingDataSource(); // Set the standard properties dataSource.setDatabase ("localhost/3050:c:/database/test_charset.fdb"); dataSource.setDescription ("An example database of employees"); /* * Following properties were not deleted in order to show differences * between InterClient 2.01 data source implementation and Firebird one. */ //dataSource.setDataSourceName ("Employee"); //dataSource.setPortNumber (3060); //dataSource.setNetworkProtocol ("jdbc:interbase:"); //dataSource.setRoleName (null); // Set the non-standard properties //dataSource.setCharSet (interbase.interclient.CharacterEncodings.NONE); //dataSource.setSuggestedCachePages (0); //dataSource.setSweepOnConnect (false); // this some kind of equivalent to dataSource.setNetworkProtocol(String) // possible values are "type4", "type2" and "embedded". dataSource.setType("TYPE4"); // SQL Role can be set like this: // // dataSource.setRoleName("USER"); // Character encoding for the connection is set to NONE dataSource.setEncoding("ISO8859_1"); // other non-standard properties do not have setters // you can pass any DPB parameter // // dataSource.setNonStandardProperty("isc_dpb_sweep", null); // dataSource.setNonStandardProperty("isc_dpb_num_buffers", "75"); // Connect to the Firebird DataSource try { dataSource.setLoginTimeout (10); java.sql.Connection c = dataSource.getConnection ("sysdba", "masterkey"); java.sql.Statement stmt = c.createStatement(); java.sql.ResultSet rs = stmt.executeQuery("SELECT * FROM test_charset"); while(rs.next()) System.out.println("a1 = " + rs.getString(1) + ", a2 = " + rs.getString(2)); stmt.close(); // At this point, there is no implicit driver instance // registered with the driver manager! System.out.println ("got connection"); c.close (); } catch (java.sql.SQLException e) { e.printStackTrace(); System.out.println ("sql exception: " + e.getMessage ()); } } } 中使用了它,它对我来说很好。

appDelegate

但是当我在 [[UIView appearanceWhenContainedIn:[UITabBar class], nil] setTintColor:[UIColor whiteColor]]; [[UITabBar appearance] setTintColor:[UIColor whiteColor]]; 课程中设置启用False时,它将变为灰色。

答案 1 :(得分:0)

  // this will generate a red tab bar
    tabBarController.tabBar.barTintColor = [UIColor redColor];

    // this will give selected icons and text your apps tint color
    tabBarController.tabBar.tintColor = [UIColor redColor];

更新:

self.tabBarController.tabBar.barTintColor = [UIColor blackColor];
self.tabBarController.tabBar.translucent = false;
self.tabBarController.tabBar.tintColor = [UIColor blueColor];