IOS 今天學到太多的知識了,趕快記錄下來

來源:互聯網
上載者:User

標籤:

TabBarController 修改tabbar的背景顏色和選中時候的顏色:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {        // Override point for customization after application launch.                application.registerUserNotificationSettings(UIUserNotificationSettings(            forTypes:UIUserNotificationType.Badge, categories: nil))                UIApplication.sharedApplication().cancelAllLocalNotifications()                let localNotification = UILocalNotification()        localNotification.applicationIconBadgeNumber = 78        UIApplication.sharedApplication().scheduleLocalNotification(localNotification)                UITabBar.appearance().tintColor = UIColor(red: 227.0/255.0, green: 28.0/255.0, blue: 31.0/255.0, alpha: 1)        UITabBar.appearance().barTintColor = UIColor(red: 0, green: 0, blue: 0, alpha: 1)                return true    }

文章連結:http://www.uisdc.com/xcode-tutorials-for-designer-4

設定 Tabbaritem 上的圖章

 

class myTabBarController: UITabBarController, UITabBarControllerDelegate {    override func viewDidLoad() {        super.viewDidLoad()                self.delegate = self                NSLog("Number of view controllers: \(self.viewControllers?.count)")                self.viewControllers![0].tabBarItem.badgeValue = String(100)        self.viewControllers![1].tabBarItem.badgeValue = "..."        self.viewControllers![2].tabBarItem.badgeValue = "s"        self.viewControllers![3].tabBarItem.badgeValue = "-"                //self.viewControllers![0].tabBarItem.        // Do any additional setup after loading the view.    }    override func didReceiveMemoryWarning() {        super.didReceiveMemoryWarning()        // Dispose of any resources that can be recreated.    }        /*    // MARK: - Navigation    // In a storyboard-based application, you will often want to do a little preparation before navigation    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {        // Get the new view controller using segue.destinationViewController.        // Pass the selected object to the new view controller.    }    */}

 

手工建立一個TabbarController: http://www.cnblogs.com/wendingding/p/3775488.html

 

Swift - 設定應用程式圖示的提醒個數(右上方小紅圈)2015-07-22 10:20發布:hangge瀏覽:433 使用UILocalNotification除了可以實現本地訊息的推送功能(可以設定推送內容,推送時間,提示音),還可以設定應用程式右上方的提醒個數。 下面示範如何設定,如下: --- AppDelegate.swift ---
123456789101112131415161718192021222324252627282930 import UIKit @UIApplicationMainclass AppDelegateUIResponderUIApplicationDelegate {     var window: UIWindow?     func application(application: UIApplication,        didFinishLaunchingWithOptions launchOptions: [NSObjectAnyObject]?) -> Bool {        application.registerUserNotificationSettings(UIUserNotificationSettings(            forTypes: UIUserNotificationType.Sound UIUserNotificationType.Alert |            UIUserNotificationType.Badge, categories: nil))        return true    }     func applicationWillResignActive(application: UIApplication) {    }     func applicationDidEnterBackground(application: UIApplication) {    }     func applicationWillEnterForeground(application: UIApplication) {    }     func applicationDidBecomeActive(application: UIApplication) {    }     func applicationWillTerminate(application: UIApplication) {    }}

--- ViewController.swift ---
123456789101112131415161718192021222324252627 import UIKit class ViewControllerUIViewController {         override func viewDidLoad() {        super.viewDidLoad()                 //發送通知訊息        scheduleNotification();    }         //發送通知訊息    func scheduleNotification(){        //清除所有本地推送        UIApplication.sharedApplication().cancelAllLocalNotifications()                 //建立UILocalNotification來進行本地訊息通知        var localNotification = UILocalNotification()        //設定應用程式右上方的提醒個數        localNotification.applicationIconBadgeNumber = 78;        UIApplication.sharedApplication().scheduleLocalNotification(localNotification)    }         override func didReceiveMemoryWarning() {        super.didReceiveMemoryWarning()    }}


原文出自:www.hangge.com  轉載請保留原文連結:http://www.hangge.com/blog/cache/detail_796.html

IOS 今天學到太多的知識了,趕快記錄下來

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.