Time of Update: 2014-03-22
直接貼代碼了#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad{ [super viewDidLoad]; NSLog(@"----%@---",[self decimalwithFormat:@"0.0000" floatV:0.334]); NSLog(@"----%@---",[self
Time of Update: 2014-03-22
解決方案:使用如下代碼: NSDate *date=[_pickerVIew date]; NSDateFormatter *formatter=[[NSDateFormatter alloc]init]; formatter.dateFormat=@"yy-MM-dd HH:mm:ss"; NSString *timeStr=[formatter stringFromDate:date]; NSLog(@"date-----%@",date); NSLog(
Time of Update: 2014-03-22
繼續說說ios不同版本之間的適配先說一個東西:在xcode當中有一個東西叫targets,蘋果的官方文檔是這樣說的:A target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace. A target defines a single product; it organizes the
Time of Update: 2014-03-22
1.先看xib效果然後用模擬器跑出來就是這個樣子了顯然,下面的視圖錯位了根據經驗,可能引發這種問題的原因:1.跟視圖選擇的尺寸問題,選擇的是4寸,結果跑在了3.5寸上面vcD4KPHA+Mi7T0Lj2VXNlQXV0b0xheW91dNGhz+6jrMSsyM/Kx7m00aG1xKOs1eK49tKyv8nE3NL9t6LK0828tO3OuzwvcD4KPHA+My5BdXRvU2l6aW5n0aHU8bXEzsrM4qO6PGltZyBzcmM9"http://www.2cto.com/
Time of Update: 2014-03-22
Foundation架構中常用的類有:NSString、NSArray、NSSet、NSDictionary 以及它們對應的子類
Time of Update: 2014-03-19
iOS 7中預設的導覽列在開始定製之前,我們先來看看iOS 7中預設導覽列的外觀。通過Xcode用Single View Controller模板建立一個工程。然後將view controller嵌入到一個navigation controller中。如果你不想從頭開始,那麼也可以在這裡下載到這個樣本工程。Xcode 5包含有iOS 6和iOS
Time of Update: 2014-03-19
本人在做ios開發的時候碰到一個老生常談的問題,UITextField被鍵盤遮蔽問題,網上搜尋了一些資料,找到了兩種前輩寫的方案,方案一:http://blog.csdn.net/springsky_/article/details/7941858,在ios5之前適用,但是在5之後盤布局變了,尤其是中文輸入時,中文漢字選擇框就固定在鍵盤上方,於是有前輩出了第二種方案:http://www.apkbus.com/home.php?mod=space&uid=
Time of Update: 2014-03-15
- (id)init{ self = [super init]; if (self) { /* OSStatus AudioSessionInitialize ( CFRunLoopRef inRunLoop, //運行迴圈的中斷監聽器回調應該被運行。傳遞NULL,使用主運行迴圈。 CFStringRef
Time of Update: 2014-03-19
地圖類開發應用中,離不開地理位置跟MKMapView的使用,下面就記錄下自己在使用這兩個東西中學到的。 不過並不是所有蘋果的裝置都支援地理位置,我們在使用前應該做個判斷,代碼如下: 1 BOOL locationAvailabe = [CLLocationManager locationServicesEnabled];2 BOOL magnetometerAvailable = [CLLocationManager
Time of Update: 2014-03-18
如果是Xcode 5的話步驟為 點擊項目名稱->Build Settings->搜尋 Architectures 這個裡面的原始的值是Standard architectures(armv7,armv7s,arm64) 點擊這個值,在下拉式清單方塊中選擇 Standard architectures(armv7,armv7s) ,然後儲存項目,轉到 General裡面去就可以看到項目的Target選項裡面會從4.3到7.0都有。如果是Xcode 5.1的話步驟為
Time of Update: 2014-03-12
本文實現了放大鏡功能,具體用法如下1、將MagnifierView類匯入到工程中,在例子中就有的。:http://pan.baidu.com/s/1eUz2QViewController.h#import #import "MagnifierView.h"@interface ViewController : UIViewController@property (strong , nonatomic) MagnifierView* loop;@property (strong ,
Time of Update: 2014-03-13
首先產生一個繼承與UILabel的類SFPStrikeThroughAndUnderLineLabel一,在.h檔案裡@interface SFPStrikeThroughAndUnderLineLabel : UILabel{ BOOL _isWithStrikeThrough; } @property (nonatomic, assign) BOOL isWithStrikeThrough;
Time of Update: 2014-03-13
ViewController.h //// ViewController.h// 放大鏡例子//// Created by 杜甲 on 14-3-10.// Copyright (c) 2014年 杜甲. All rights reserved.//#import #import MagnifierV.h@interface ViewController : UIViewController@property (strong , nonatomic)
Time of Update: 2014-03-14
建立Singleton.h <Foundation/Foundation.h> - ()playSoundWithName:(NSString * 將APP要用到的音效添加到建立的bound裡去建立Singleton.m <AudioToolbox/AudioToolbox.h>*_soundDict; - (= _soundDict
Time of Update: 2014-03-12
首先,先介紹一下FontAwesome。Font Awesome 是為 Twitter Bootstrap 設計的表徵圖字型。通過Web Font的方式來顯示一些表徵圖,好處是表徵圖可以被任意縮放、改變顏色,你需要做的只是像修改文字樣式那樣修改表徵圖樣式。
Time of Update: 2014-03-13
兩種方式建立UIButton的對象。(1) UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(100, 50, 100, 75)]; [button setTitle:@"close" forState:UIControlStateNormal]; button.backgroundColor = [UIColor greenColor];//button的背景顏色 [button
Time of Update: 2014-03-10
眾所周知,我們在開發APP時,涉及網路連接的時候,都會想著提前判斷一下當前的網路連接狀態,如果沒有網路,就不再請求url,省去不必要的步驟,所以,這個如何判斷?其實很簡單。前提:工程添加:SystemConfiguration.framework framework去蘋果API裡搜尋Reachability,下載demo,把demo裡的Reachability.h和Reachability.m拖到自己的工程裡然後在需要判斷的類中包含標頭檔:#import "Reachability.h"
Time of Update: 2014-03-10
通常用於刪除緩衝的時,計算緩衝大小//單個檔案的大小- (long long) fileSizeAtPath:(NSString*) filePath{ NSFileManager* manager = [NSFileManager defaultManager]; if ([manager fileExistsAtPath:filePath]){ return [[manager attributesOfItemAtPath:filePath error:nil]
Time of Update: 2014-03-10
1.什麼是記憶體管理 行動裝置的記憶體極其有限,每個app所能佔用的記憶體是有限制的當app所佔用的記憶體較多時,系統會發出記憶體警告,這時得回收一些不需要再使用的記憶體空間。比如回收一些不需要使用的對象、變數等管理範圍:任何繼承了NSObject的對象需要去管理記憶體,但是對於對其他基礎資料型別 (Elementary Data Type)(int、char、float、double、struct、enum等)結構,枚舉等不用去關心記憶體複製代碼- (void)test{
Time of Update: 2014-03-10
內購——在應用程式內購買 (Nonconsumable)買了就有,頭銜,功能(Consumable),買了就用,用了就沒 定義的商品 定義好的商品#define kIAPBomb @"airplay.10bombs"#define kIAPBullet