C is not Swift. You’ll be happier if you structure your switch
statements using curly braces round all of the cases interiors, like this:
switch (tag) {
case 1: { // curly braces
// ...
break;
}
case 2: { // curly braces
// ...
break;
}
case 3: { // curly braces
// ...
break;
}
}
The extra level of curly braces allows you to do things you can’t do otherwise.
Related Contents:
- Can Objective-C switch on NSString?
- Change status bar text color to light in iOS 9 with Objective-C [duplicate]
- Declaring variables inside a switch statement [duplicate]
- Case in protected switch [duplicate]
- Xcode 7 iOS 9 UITableViewCell Separator Inset issue
- Can I declare variables inside an Objective-C switch statement?
- Using an NSString in a switch statement
- How to send POST and GET request?
- Invalid Swift Support / The SwiftSupport folder is empty
- setStatusBarHidden is deprecated in iOS 9.0
- In Objective-C, how do I test the object type?
- How to check if an NSDictionary or NSMutableDictionary contains a key?
- What is the significance of #pragma marks? Why do we need #pragma marks?
- Objective-C: Extract filename from path string
- How to stop unwanted UIButton animation on title change?
- What are the details of “Objective-C Literals” mentioned in the Xcode 4.4 release notes?
- Method Syntax in Objective-C
- What is the best way to create constants in Objective-C
- Save An Image To Application Documents Folder From UIView On IOS
- Get parts of a NSURL in objective-c
- View-based NSTableView with rows that have dynamic heights
- Class extension vs class category
- Using a constant NSString as the key for NSUserDefaults
- UIGestureRecognizer blocks subview for handling touch events
- What is the difference between ivars and properties in Objective-C
- Any way to bold part of a NSString?
- How to compare two dates in Objective-C
- UIButton events. What’s the difference?
- Implementing a method taking a block to use as callback
- How do I declare an array as a constant in Objective-c?
- AVAudioPlayer not playing any sound
- Objective C: Reading text files
- How to check the last char of an NSString
- How can I reduce the file size of a video created with UIImagePickerController?
- NSMutableArray addObject not working
- NSAssert vs. assert: Which do you use, and when?
- NSHTTPCookieStorage state not saved on app exit. Any definitive knowledge/documentation out there?
- 100% opacity UILabel over a 50% opacity background (UIView?)
- How to detect if NSString is null?
- ‘Calling a method’ OR ‘sending a message’ in Objective C
- What’s the difference between arc4random and arc4random_uniform? [duplicate]
- How programmatically move a UIScrollView to focus in a control above keyboard?
- Check if an NSString is just made out of spaces
- Accessing command line arguments in Objective-C
- NSXMLParser Simple Example
- How to get file size properly and convert it to MB, GB in Cocoa? [duplicate]
- accessing a file using [NSBundle mainBundle] pathForResource: ofType:inDirectory:
- Is there a convenient function in objective-c / cocoa-touch to find a lowest number?
- Creating breakpoint in Xcode for unrecognized selector
- Why does NSDateFormatter return nil date for these 4 time zones?