[iOS] 程式片段 : Code Snippets

文字框輸入完 keyboard 收起來

// --- define :
@property (nonatomic, retain) IBOutlet UITextField *txtInput;

// --- code :

- (BOOL)textFieldShouldReturn:(UITextField *)theTextFied {

	if(txtInput == theTextFied)
	{
		[txtInput resignFirstResponder];
	}

	//Update the label.
	lblMessage.text = txtInput.text;

	return YES;
}

ex: http://furnacedigital.blogspot.tw/2012/01/blog-post_20.html#more

 

 

 

 

陣列 Array 用法

    NSArray *array =[ [NSArray alloc] initWithObjects:
		@"銷售總覽",
		@"訂單管理",
		@"上架商品",
		@"廣告中心",
		nil
	];
    self.listdata = array;
    [array release];

 

NSArray :

NSArray *myArray;
NSDate *aDate = [NSDate distantFuture];
NSValue *aValue = [NSNumber numberWithInt:5];
NSString *aString = @"a string";

myArray = [NSArray arrayWithObjects:aDate, aValue, aString, nil];

[solved] codesign error : codesigning is required for product type application in sdk device ios

Xcode->Project ->Edit Project Settings->Build (tab)->Code Signing Identity (header) ->Any iOS (change from Any iOS Simulator)->(select ‘iPhone Developer’ as value and it will default to the wildcard development provisioning profile (Team Provisioning Profile: * )

Most common cause, considering that all certificates are installed properly is not specifying the Code Signing Identity in the Active Target settings along with the Project settings. Change these from to iPhone Developer (Xcode will select the right profile depending on App ID match).

  • In Xcode , change from Simulator to Device (in the dropdown at the top of the Xcode window), so that your target for application deployment will be the Device.
  • The default ID which is a wild card ID is like a catch all iD, when associated in Code Signing (if you are using sample files to build, they will most obviously not have com.coolapps.appfile imports, in which case without the ‘Team Provisioning profile’, your build would fail. So you would want to set this in your
  • Xcode->Project ->Edit Project Settings->Build (tab)->Code Signing Identity (header) ->Any iOS (change from Any iOS Simulator)->(select ‘iPhone Developer’ as value and it will default to the wildcard development provisioning profile (Team Provisioning Profile: * )

and also (VERY IMPORTANT)

  • Xcode->Project ->Edit Active Target ->Build (tab)->Code Signing Identity (header) ->Any iOS (change from Any iOS Simulator)->(select ‘iPhone Developer’ as value and it will default to the wildcard development provisioning profile (Team Provisioning Profile: * )

Complete steps for a beginner at: http://codevelle.wordpress.com/2010/12/21/moving-from-ios-simulator-to-the-ios-device-smoothly-without-code-sign-error/