IOS 今天学到太多的知识了,赶快记录下来
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 =
UIApplication.sharedApplication().scheduleLocalNotification(localNotification)
UITabBar.appearance().tintColor = UIColor(red: 227.0/255.0, green: 28.0/255.0, blue: 31.0/255.0, alpha: )
UITabBar.appearance().barTintColor = UIColor(red: , green: , blue: , alpha: )
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![].tabBarItem.badgeValue = String()
self.viewControllers![].tabBarItem.badgeValue = "..."
self.viewControllers![].tabBarItem.badgeValue = "s"
self.viewControllers![].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 - 设置应用程序图标的提醒个数(右上角小红圈)

|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import UIKit@UIApplicationMainclass AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> 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 ---
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import UIKitclass ViewController: UIViewController { 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
文章有个回复说 UIViewController 会修改第一个子view的 contentInset,
IOS 今天学到太多的知识了,赶快记录下来的更多相关文章
- 代码实现:当我们下载一个试用版软件,没有购买正版的时候,每执行一次就会提醒我们还有多少次使用机会用学过的IO流知识,模拟试用版软件,试用10次机会,执行一次就提示一次您还有几次机会,如果次数到了提示请购买正版
package com.loaderman.test; import java.io.BufferedReader; import java.io.FileReader; import java.io ...
- 融e学 一个专注于重构知识,培养复合型人才的平台【获取考试答案_破解】
考试系统-融e学-一个专注于重构知识,培养复合型人才的平台.[获取答案] ganquanzhong 背景:今天去完成学校在融e学上开设的必修课和选修课考试,由于自己的时间有限(还有其他的事情要去做). ...
- iOS开发系列--C语言之基础知识
概览 当前移动开发的趋势已经势不可挡,这个系列希望浅谈一下个人对IOS开发的一些见解,这个IOS系列计划从几个角度去说IOS开发: C语言 OC基础 IOS开发(iphone/ipad) Swift ...
- 月薪45K的Python爬虫工程师告诉你爬虫应该怎么学,太详细了!
想用Python做爬虫,而你却还不会Python的话,那么这些入门基础知识必不可少.很多小伙伴,特别是在学校的学生,接触到爬虫之后就感觉这个好厉害的样子,我要学.但是却完全不知道从何开始,很迷茫,学的 ...
- IOS学习之路--OC的基础知识
1.项目经验 2.基础问题 3.指南认识 4.解决思路 ios开发三大块: 1.Oc基础 2.CocoaTouch框架 3.Xcode使用 -------------------- CocoaTouc ...
- iOS/OS X线程安全的基础知识
处理多并发和可重入性问题,是每个库发展过程中面临的比较困难的挑战之一.在Parse平台上,我们尽最大的努力保证你在使用我的SDKs时所做的操作都是线程安全的,保证不会出现性能问题. 在这篇文章中我们将 ...
- 谷哥的小弟学前端(10)——JavaScript基础知识(1)
探索Android软键盘的疑难杂症 深入探讨Android异步精髓Handler 具体解释Android主流框架不可或缺的基石 站在源代码的肩膀上全解Scroller工作机制 Android多分辨率适 ...
- 浪首登录浮层增加收藏入口项目学到的几点知识-IE7 bug、relatedTarget、字符串换行
这两天做这个项目略有收获,记录如下: 1. 项目中有个bug,在IE7中登录成功时下拉菜单没有展开的情况下总有个残影在页面中,如下图所示: 通过多种方法都没有解决,后来才知道原来是在IE中displa ...
- iOS AppIcon + launchImage+iPhone 屏幕分辨率相关知识
本文主要包含不同iOS 版本的尺寸,分辨率,以及appIcon,launchImage 对不同iOS 版本的适配问题 以下是主要主要的参考资料 https://developer.apple.com/ ...
随机推荐
- Java for LeetCode 198 House Robber
You are a professional robber planning to rob houses along a street. Each house has a certain amount ...
- Java for LeetCode 030 Substring with Concatenation of All Words【HARD】
You are given a string, s, and a list of words, words, that are all of the same length. Find all sta ...
- July 12th, Week 29th Tuesday, 2016
When the traveler goes alone he gets acquainted with himself. 独自旅行可以让人更好地了解自己. With other's company, ...
- MVC模式简介
MVC模式是一种表现模式,它将web应用程序分成三个主要部分即:模型(Model)视图(View)控制器(Controller)M:Model主要是存储或者是处理数据的模型,包含了用户使用的数据,业务 ...
- Floyd最短路算法
Floyd最短路算法 ----转自啊哈磊[坐在马桶上看算法]算法6:只有五行的Floyd最短路算法 暑假,小哼准备去一些城市旅游.有些城市之间有公路,有些城市之间则没有,如下图.为了节省经费以及方便计 ...
- Linus的redHat在root出现错误:-bash: addgroup: command not found
在root下无法完成添加用户组操作,如下: [root@host8 ~]# addgroup hadoop-bash: addgroup: command not found 这是的,root下竟然不 ...
- Android开发之日历控件实现
Android开发之日历控件实现:以下都是转载的. 日历控件 日历控件 日历控件 日历控件
- ODTwithODAC认识与安装图解
ODTwithODAC认识 ODTwithODAC是用.Net 开发工具时,使用Oracle数据库时, 启连接作用. 安装完ODTwithODAC之后,一般需要安装 Oracle 客户端(比如win3 ...
- c#日记
//返回一个指定类型的对象,该对象的值等于指定对象的值 object obj1 = Convert.ChangeType(dw[findRowIndex][cna ...
- C# 中distinct的使用
假设我们有一个类:Product public class Product { public string Id { get; set; } public string Name { get; set ...