原创 [LeetCode]Serialize and Deserialize Binary Tree

題目鏈接:Serialize and Deserialize Binary Tree 題目內容: Serialization is the process of converting a data structure or objec

原创 (一二六)單線程文件下載與斷點續傳

本文討論單線程的文件下載和斷點續傳,通過從本地服務器下載一個較大的文件,實現顯示進度、中途暫停與斷點續傳。 下載過程大致如下: ①通過NSURL創建指向特定下載地址的請求,本文中下載的文件位於網站根目錄的lesson1下的nav.dmg,

原创 [LeetCode]Range Sum Query - Mutable

題目鏈接:Range Sum Query - Mutable 題目內容: Given an integer array nums, find the sum of the elements between indices i an

原创 [LeetCode]Additive Number

題目鏈接:Additive Number 題目內容: Additive number is a positive integer whose digits can form additive sequence. A valid a

原创 (一二八)使用POST上傳文件

簡介 上傳文件到服務器是一個比較常用的操作,最基本的方式是通過POST上傳,文件以二進制形式,作爲一個參數傳遞,但是這個POST的結構相當複雜,且必須完全符合HTTP標準。 文件上傳的POST格式 該POST主要由下面幾個部分構成

原创 UIScrollView實現圖片輪播器的無限滾動

簡介 在現在的一些App中常常見到圖片輪播器,一般用於展示廣告、新聞等數據,在iOS內並沒有現成的控件直接實現這種功能,但是通過UIScrollView的允許分頁設置,可以實現滾動輪播的功能。 輪播原理 UIScrollView對

原创 (一二七)NSURLSession的基本用法 下載與數據獲取

簡介 NSURLSession是蘋果官方提供的一系列網絡接口庫,使用他們可以輕鬆實現下載和數據獲取等任務。在上一篇文章中,我們介紹了使用NSURLConnection下載文件和斷點續傳的功能,實現起來比較麻煩,對於文件的操作也比較

原创 [LeetCode]Perfect Squares

題目鏈接:Perfect Squares 題目內容: Given a positive integer n, find the least number of perfect square numbers (for example, 

原创 [LeetCode]Populating Next Right Pointers in Each Node

題目鏈接:Populating Next Right Pointers in Each Node 題目內容: Given a binary tree struct TreeLinkNode { TreeLinkNo

原创 1101. Quick Sort (25)

題目如下: There is a classical process named partition in the famous quick sort algorithm. In this process we typically

原创 [LeetCode]Longest Increasing Subsequence

題目鏈接:https://leetcode.com/problems/longest-increasing-subsequence/ 題目內容: Given an unsorted array of integers, find

原创 [LeetCode]Binary Tree Zigzag Level Order Traversal

題目鏈接:Binary Tree Zigzag Level Order Traversal 題目內容: Given a binary tree, return the zigzag level order traversal of i

原创 [LeetCode]Bulls and Cows

題目地址:https://leetcode.com/problems/bulls-and-cows/ 題目內容: You are playing the following Bulls and Cows game with your

原创 (一二九)獲取文件的MineType、利用SSZipArchive進行壓縮解壓

MineType 簡介 文件在網絡上以二進制流的方式傳播,爲了區分不同的文件類型,用MineType來標明。 爲什麼要獲取 文件的拓展名較短,比較好記,但是MineType是很長的,比如docx拓展名的MineType是appli

原创 (一三〇)UITextField的光標操作擴展

簡介 在iOS開發中,有時候需要完全自主的定義鍵盤,用於完整的單詞輸入,例如計算機應用中,需要一次性的輸入sin(,在移動光標時要完整的跳過sin(,在刪除時也要完整的刪除,這就需要對光標的位置進行精確控制,而iOS並沒有相關的函