iOS 如何在無 TableViewController 時結束 UIRefreshControl
問題背景 在沒有使用 UITableViewController 的情況下,手動創建了 UIRefreshControl 並添加到 UITableView 中。
iOS CLLocationManager startMonitoringSignificantLocationChanges 在 iOS 5 不回調的解決方法
問題現象 使用 startMonitoringSignificantLocationChanges,iOS 6 正常觸發 locationManager:did
iOS 限制 App 僅在 Retina 設備運行的實現方案:UIRequiredDeviceCapabilities
需求分析 希望 App 僅安裝在配備 Retina 屏幕的設備上(iPhone 4/4S/5/5s/5c 及更新機型),排除 iPhone 3G/3GS 等非
iOS NSDictionary 與 CGPoint 相互轉換的標準 API:CGPointCreateDictionaryRepresentation
場景 游戲開發中需將觸摸坐標 CGPoint 存入 NSDictionary 傳遞給 performSelector:withObject:afterDelay
Objective-C 字符串替換特殊字符(如圓點 •)失效的真相與解決方法
問題現象 [myString stringByReplacingOccurrencesOfString:@• withString:@<BULLET_PO
iOS UDID 棄用後獲取設備唯一標識符的推薦方案:OpenUDID
背景 自 iOS 5 起 [[UIDevice currentDevice] uniqueIdentifier] 被棄用,App Store 審核拒絕調用該 A
Android 解析 JSON 數組字符串填充 ListView 的正確姿勢
數據格式 服務器返回如下 JSON 字符串(頂層為數組): [ { id: picture1, caption: sample captio
Android ExpandableListView 調整 Group/Child 項目間距的正確屬性與常見坑
問題描述 使用 ExpandableListView 做樹形列表,項目間距太小。嘗試在 XML 設置 android:dividerHeight=10dp 報錯
Java 泛型未檢查轉型警告 Type safety: Unchecked cast 的最佳處理方式
警告場景 Handler 傳遞消息時 message.obj = list,接收端強轉 mList.addAll((List) msg.obj) 產生警告:Ty
JavaScript 禁止頁面滾動但保留輸入框可聚焦的解決方案
問題現象 在 iPhone WebApp 中使用 document.ontouchstart = function(e){ e.preventDefault()
iOS 獲取圖片方向的私有函數 ui_orientation 替代方案
問題由來 在 WWDC 2012 Session 510 中示例代碼使用 ui_orientation() 將 CGImage 的方向屬性轉換為 UIImage
iOS KVC 巢狀屬性訪問需用 valueForKeyPath 而非 valueForKey
調用 [obj valueForKey:@profile.firstName] 崩潰 not key value coding-compliant for th
Android ACTION_SEND 郵件意圖:EXTRA_EMAIL 數組需在賦值後構建
發送郵件時,EXRA_EMAIL 數組構建在 setEmailParameters() 之前,導致數組元素為空。 錯誤順序 String emailAddres
Android AnimationDrawable 設置背景報空指針:ImageView 未正確綁定
設置 img.setBackgroundResource(R.drawable.loader_animation) 時報空指針。 原因 img 為 null,即
Android LinearLayout 中 ImageView 水平垂直居中:layout_gravity 屬性
LinearLayout 中 ImageView 需水平垂直居中顯示。 XML 設置 <LinearLayout android:layout_w
iOS UILabel 點擊打開網址:需獲取 text 屬性而非控件本身
點擊 UILabel 打開網址,代碼傳入 self.agencyWebsite (UILabel) 導致崩潰。 錯誤代碼 NSURL *url = [NSURL
iOS 通過 canOpenURL 檢測 Google Maps 是否安裝並彈出提示框
需檢測設備是否安裝 Google Maps,並在未安裝時提示用戶。 檢測代碼 BOOL canOpen = [[UIApplication sharedAppl