123456789101112131415161718192021222324252627282930313233343536373839
// 定義名稱 define key

#define kIsActive @"isActive"

#define kUserName @"userName"

 

// 讀取資料

-(void)loadInfo {

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

NSLog(@"Name : %@", [defaults stringForKey:kUserName]);

NSLog(@"isActive : %@", ([defaults boolForKey:kIsActive] ? @"YES" : @"NO"));

}

 

// 儲存資料

-(void)saveInfo {

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

NSString *userName = @"Hank";

BOOL isActive = YES;

[defaults setObject:userName forKey:kUserName];

[defaults setBool:isActive forKey:kIsActive];

}

 

// 清除資料

-(void)clearInfo {

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

 

[defaults removeObjectForKey:kUserName];

[defaults removeObjectForKey:kIsActive];

}

 

// 執行

- (void)viewDidLoad

{

[super viewDidLoad];

 

[self saveInfo];

[self loadInfo];

 

[self clearInfo];

[self loadInfo];

}






pcwiki 發表在 痞客邦 留言(0) 人氣()

[UIView animateWithDuration:0.5
delay:1.0
options: UIViewAnimationCurveEaseOut
animations:^{
self.basketTop.frame = basketTopFrame;
self.basketBottom.frame = basketBottomFrame;
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
[UIView animateWithDuration:0.6f

pcwiki 發表在 痞客邦 留言(0) 人氣()

http://0922267152.blogspot.tw/2011/04/blog-post_13.html
 


Math functions


double pow ( double, double ) - power of



NSLog(@"%.f", pow(3,2) ); //result 9
NSLog(@"%.f", pow(3,3) ); //result 27


double sqrt( double ) - square root



NSLog(@"%.f", sqrt(16) ); //result 4
NSLog(@"%.f", sqrt(81) ); //result 9


double ceil ( double ) - if the argument has any decimal part, returns the next bigger integer



NSLog(@"res: %.f", ceil(3.000000000001)); //result 4
NSLog(@"res: %.f", ceil(3.00)); //result 3


double floor ( double ) - removes the decimal part of the argument



NSLog(@"res: %.f", floor(3.000000000001)); //result 3
NSLog(@"res: %.f", floor(3.9999999)); //result 3


double round ( double ) - rounds the argument



NSLog(@"res: %.f", round(3.5)); //result 4
NSLog(@"res: %.f", round(3.46)); //result 3
NSLog(@"res: %.f", round(-3.5)); //NB: this one returns -4


double fmin ( double, double ) - returns the smaller argument



NSLog(@"res: %.f", fmin(5,10)); //result 5


double fmax ( double, double ) - returns the bigger argument



NSLog(@"res: %.f", fmax(5,10)); //result 10


double fabs( double ) - returns the absolute value of the argument



NSLog(@"res: %.f", fabs(10)); //result 10
NSLog(@"res: %.f", fabs(-10)); //result 10


 


Few math constants


As found in the math.h



#define M_E 2.71828182845904523536028747135266250 /* e */
#define M_LOG2E 1.44269504088896340735992468100189214 /* log 2e */
#define M_LOG10E 0.434294481903251827651128918916605082 /* log 10e */
#define M_LN2 0.693147180559945309417232121458176568 /* log e2 */
#define M_LN10 2.30258509299404568401799145468436421 /* log e10 */
#define M_PI 3.14159265358979323846264338327950288 /* pi */
#define M_PI_2 1.57079632679489661923132169163975144 /* pi/2 */
#define M_PI_4 0.785398163397448309615660845819875721 /* pi/4 */
#define M_1_PI 0.318309886183790671537767526745028724 /* 1/pi */
#define M_2_PI 0.636619772367581343075535053490057448 /* 2/pi */
#define M_2_SQRTPI 1.12837916709551257389615890312154517 /* 2/sqrt(pi) */
#define M_SQRT2 1.41421356237309504880168872420969808 /* sqrt(2) */
#define M_SQRT1_2 0.707106781186547524400844362104849039 /* 1/sqrt(2) */
#define MAXFLOAT ((float)3.40282346638528860e+38)



pcwiki 發表在 痞客邦 留言(0) 人氣()


來源:http://blog.csdn.net/baidu_21172753/article/details/42678487
 
1.进入 https://developer.apple.com,选择Member Center,进去后点击iTunes Connect,输入账号密码。进去后,点击我的APP,然后点击左侧的加号,就可以创建应用了
2.创建应用需要填写必要信息

pcwiki 發表在 痞客邦 留言(0) 人氣()

When you tap a row in a UITableView, the row is highlighted and selected. Is it possible to disable this so tapping a row does nothing?
 
 

pcwiki 發表在 痞客邦 留言(0) 人氣()

並發的意思就是同時運行多個任務,這些任務可以在單核CPU上以分時(時間共享)的形式同時運行,或者在多核CPU上以真正的並行來運行多任務。



在移動和桌面操作系統中,蘋果提供了相同的並發編程API。 NSThread、Grand Central Dispatch(GCD)、NSOperationQueue

pcwiki 發表在 痞客邦 留言(0) 人氣()

Documentation says that parent SKView object has a paused property. Set it to YES to pause the scene.

Paused
Boolean value that indicates whether the view’s scene animations are paused.
@property(getter=isPaused, nonatomic) BOOL paused
Discussion If the value is YES, then the scene’s content is fixed on screen. No actions are executed and no physics simulation is performed."

pcwiki 發表在 痞客邦 留言(0) 人氣()






Have you tried exit(0)?


Alternatively, [[NSThread mainThread] exit], although I have not tried that it seems like the more appropriate solution.


 


On the iPhone there is no concept of quitting an app. The only action that should cause an app to quit is touching the Home button on the phone, and that's not something developers have access to.


According to Apple, your app should not terminate on its own. Since the user did not hit the Home button, any return to the Home screen gives the user the impression that your app crashed. This is confusing, non-standard behavior and should be avoided.


 


After some tests, I can say the following:



  • using the private interface : [UIApplication sharedApplication] will cause the app looking like it crashed, BUT it will call - (void)applicationWillTerminate:(UIApplication *)application before doing so;

  • using exit(0); will also terminate the application, but it will look "normal" (the springboard's icons appears like expected, with the zoom out effect), BUT it won't call the - (void)applicationWillTerminate:(UIApplication *)application delegate method.


My advice:



  1. Manually call the - (void)applicationWillTerminate:(UIApplication *)application on the delegate.

  2. Call exit(0);.










shareimprove this answer







 

















    


Apple says not to use exit due to "Applications calling exit will appear to the user to have crashed, rather than performing a graceful termination and animating back to the Home screen"developer.apple.com/library/ios/#qa/qa2008/qa1561.html –  Micky Duncan Sep 5 '12 at 22:20






pcwiki 發表在 痞客邦 留言(0) 人氣()

Lets say that you have a particle already created called MyParticle.sks.
First, you have to create a SKEmitterNode with your particle:
NSString *myParticlePath = [[NSBundle mainBundle] pathForResource:@"MyParticle" ofType:@"sks"];
SKEmitterNode *myParticle = [NSKeyedUnarchiver unarchiveObjectWithFile:myParticlePath];

pcwiki 發表在 痞客邦 留言(0) 人氣()

You can use this code to flip among x-axis:
spriteNode.xScale = spriteNode.xScale *-1;

pcwiki 發表在 痞客邦 留言(0) 人氣()

Maybe queuing the contacts and handle then in -update is what you need. For example:
Declare an instance variable called NSMutableArray *_contactQueue; Add the contacts to the array:
-(void) didBeginContact:(SKPhysicsContact*)contact
{[_contactQueue addObject:contact];}

pcwiki 發表在 痞客邦 留言(0) 人氣()

今天尝试着在一个ViewController上面调用:
 


[cpp] view plaincopy在CODE上查看代码片派生到我的代码片
 




  • - (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated  

  • pcwiki 發表在 痞客邦 留言(0) 人氣()

    Blog Stats
    ⚠️

    成人內容提醒

    本部落格內容僅限年滿十八歲者瀏覽。
    若您未滿十八歲,請立即離開。

    已滿十八歲者,亦請勿將內容提供給未成年人士。