Skip to content

Instantly share code, notes, and snippets.

UIStatusBarStyle in iOS 7

  • The status bar in iOS 7 is transparent, the view behind it shows through.

  • The style of the status bar refers to the appearances of its content. In iOS 7, the status bar content is either dark (UIStatusBarStyleDefault) or light (UIStatusBarStyleLightContent). Both UIStatusBarStyleBlackTranslucent and UIStatusBarStyleBlackOpaque are deprecated in iOS 7.0. Use UIStatusBarStyleLightContent instead.

How to change UIStatusBarStyle

  • If below the status bar is a navigation bar, the status bar style will be adjusted to match the navigation bar style (UINavigationBar.barStyle):
@leilee
leilee / VerticalButton.m
Last active July 24, 2017 13:51
UIButton place image & title vertical
// the space between the image and text
CGFloat spacing = 6.0;
// lower the text and push it left so it appears centered
// below the image
CGSize imageSize = button.imageView.image.size;
button.titleEdgeInsets = UIEdgeInsetsMake(
0.0, - imageSize.width, - (imageSize.height + spacing), 0.0);
// raise the image and push it right so it appears centered
@leilee
leilee / iterm2-solarized.md
Created August 28, 2016 16:06 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font (OS X / macOS)

Solarized

@leilee
leilee / FRP iOS Learning resources.md
Created August 30, 2016 06:05 — forked from JaviLorbada/FRP iOS Learning resources.md
The best FRP iOS resources.

Videos

@leilee
leilee / keywords.swift
Last active September 9, 2016 06:21
find search keyword from Swift string
let string = "Hello, World!"
var characterSet = NSMutableCharacterSet.whitespaceCharacterSet();
characterSet.formUnionWithCharacterSet(NSCharacterSet.punctuationCharacterSet())
let keywords = string.componentsSeparatedByCharactersInSet(characterSet).filter{ $0 != "" }.map { $0.lowercaseString } // ["hello", "world"]
import UIKit
class GradientView: UIView {
@IBInspectable var startColor: UIColor?
@IBInspectable var endColor: UIColor?
@IBInspectable var horizontal: Bool = true {
didSet {
let horizontalStartPoint = CGPoint(x: 0, y: 0.5)
let horizontalEndPoint = CGPoint(x: 1, y: 0.5)
import Foundation
// MARK: tableview
extension UITableView {
func dequeueReusableCellWithIndexPath<T: UITableViewCell where T: TableViewCellIdentifiable>(indexPath: NSIndexPath) -> T {
guard let cell = self.dequeueReusableCellWithIdentifier(T.cellIdentifier, forIndexPath: indexPath) as? T else {
fatalError("Couldn't instantiate view controller with identifier \(T.cellIdentifier) ")
}
// MARK: - Load View From `.xib`
extension UINib {
enum Nib: String {
case SettingHeaderView
case FreeAccountFeaturesView
case ProAccountFeaturesView
case EnterpriseAccountFeaturesView
}
@leilee
leilee / NSLayoutConstraint+Multiplier.swift
Created September 22, 2016 10:34
change multiplier property for NSLayoutConstraint
import UIKit
public extension NSLayoutConstraint {
func changeMultiplier(multiplier: CGFloat) -> NSLayoutConstraint {
let newConstraint = NSLayoutConstraint(
item: firstItem,
attribute: firstAttribute,
relatedBy: relation,
toItem: secondItem,
@leilee
leilee / gist:882842cc6646e5db2f6647a4cedb4b1a
Created September 30, 2016 07:44 — forked from steipete/ios-xcode-device-support.sh
Using iOS 10.1 devices with Xcode 8.0 (or: Xcode 7.3.1 and iOS 10 devices, same trick)
// The trick is to link the DeviceSupport folder from the beta to the stable version.
ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/10.1\ \(14B54\)/ /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
// Then restart Xcode and recommect your devices. You will need to do that for every beta of iOS 10.1+/Xcode 8.
// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)