原创 APP(iOS)端 從網頁拿到第一張圖片
class GetWebviewImageHelper: NSObject, WKScriptMessageHandler { var didGetImg: ((UIImage?) -> (V
原创 普通數組轉化爲JSONArray
這個是方法 這個是實現
原创 shareSDK配置以及遇到的問題
首先需要從cocoa pods導入 pod 'ShareSDK3' pod 'MOBFoundation' pod 'ShareSDK3/ShareSDKUI' pod 'ShareSDK3/ShareSDKPlatforms/WeCha
原创 wkwebView的 學習
自從iOS8開始,Apple引入了WKWebView欲代替UIWebView。相比而言,WKWebView消耗內從更少,功能也更加強大。讓我們來看看WKWebView怎麼使用吧! 0.初始化(1)首先需要引入WebKit庫 複製代
原创 網絡請求
標題 網絡請求 主題 前提需要用pod 導入 Alamofire SwiftyJSON 這兩個包 1.先建立一個請求json數據的方法(request文件夾) class RequestClient: NSObject 類 cl
原创 UIImagePickerController簡單使用
UIImagePickerController簡單使用 1920 0 UIImagePickerController簡單使用 UIImagePickerController簡單使用 UIImagePickerController用於管理可
原创 設置字符串中某一字爲不同的顏色
var newCreateData:NSMutableAttributedString! let str = zan + cai newCreateData = NSMutabl
原创 動態監聽鍵盤高度調整文本輸入框
//自定義鍵盤key事件 func addCustomKeyboardEvent() { NSNotificationCenter.defaultCenter().removeObserver(self)
原创 UIlabel 中的字體對齊
我們平時對於UILabel對齊只要設置想應的 firstlabel.frame.minY = secondLabel.frame.minY 就能實現label的對齊, 但是有的時候字體的大小不一樣就可能會造成 label.frame
原创 機型判斷,寫在APPdelegate裏面
private func initPhoneType() { if self.window?.frame.width == 414 { AppDelegate.phoneType = Pho
原创 textVIew 在輸入時 設置行數並且自適應高度 上移動
1.首先設置textView的frame 根據視圖的 func textViewDidChange(textView: UITextView) { //允許最高的高度的行數 maxHe
原创 設置導航欄的標題 背景顏色和字體大小
self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.blueCo
原创 swift 調用相機和相冊的demo
// // demo.swift // 相機demo // // Created by CmyLove on 16/5/3. // Copyright ©All rights reserved. // im
原创 UIButton的點擊狀態
摘要 * UIControlEventTouchDown * UIControlEventTouchDownRepeat * UIControlEventTouchDragInside * UIControlEventTouchDrag
原创 iOS 適配器模式
適配器可以讓一些接口不兼容的類一起工作。它包裝一個對象然後暴漏一個標準的交互接口。 protocol Target { func request() } class Adaptee {