1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

c switch

Last updated at Posted at 2013-02-25

C、Objective-Cではswitchの中で宣言を行う場合はcaseを波括弧で囲う必要あるようなので注意

Objective-C
- (IBAction)buttonAction:(UIButton*)sender{
	switch (sender.tag) {
		case BTN_WRITE:{
			NSData *data = [self str2data:[_txtField.text]];
			break;
		}
		case BTN_READ:{
			NSData*	data = [self file2data:@"test.txt"];
			[_txtField setText:[self data2str:data]];
		}
		default:
			break;
	}
}
1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?