Skip to content

Instantly share code, notes, and snippets.

View kusalshrestha's full-sized avatar
🐙

Kusal Shrestha kusalshrestha

🐙
View GitHub Profile
override init(frame: CGRect) {
super.init(frame: frame)
// change button background color for disabled state
UIGraphicsBeginImageContext(self.bounds.size)
let context = UIGraphicsGetCurrentContext()
CGContextSetFillColorWithColor(context, ColorConstants.unselectedGray.CGColor)
CGContextFillRect(context, self.bounds)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
@kusalshrestha
kusalshrestha / UITableView+Extension.swift
Created August 1, 2016 04:22
UITableViewHeaderFooterView Text Alignment
//
// String+Extensions.swift
//
//
// Created by Kusal Shrestha on 5/30/16.
//
//
import UIKit
@kusalshrestha
kusalshrestha / UIView+Extensions.swift
Created June 15, 2016 17:50
Making transparent background (Esp. for UItextField)
extension UIView {
func makeTransparentView(withOpacity alphaValue: CGFloat, color: UIColor) {
let backgroundView = UIView()
self.superview?.insertSubview(backgroundView, belowSubview: self)
self.backgroundColor = UIColor.clearColor()
backgroundView.alpha = alphaValue
backgroundView.backgroundColor = color
backgroundView.layer.cornerRadius = self.layer.cornerRadius