All Questions
Tagged with switch-statement objective-c
172
questions
1
vote
1
answer
267
views
How to check multiple Switch case value in Objective-C?
In Swift it is possible to check a tuple like,
switch(type1, type2) {
case (1, 1):
functionNormal()
case (1, 2):
functionUncommon()
case (1, 3):
functionRare()
...
3
votes
1
answer
1k
views
Behavior of Objective-C enum "exhaustive" switch without a default case
In Swift, the init(rawValue:) system ensures that casting an Int to an enum either results in a valid enum case or nil.
There is no such safety in Objective-C, where an invalid enum member can be ...
-1
votes
1
answer
286
views
Check Switch status from App Delegate in another View in Objective-C
I want to check the status of a Switch (is ON or OFF) in another UIView from App Delegate in Objective-C. This is my code but not working. I don't know if I have properly setup UIView header that i ...
1
vote
1
answer
101
views
IOS/Objective-C: Access to variables within switch statements
I have a switch statement that in most cases returns static values but in a few cases, I would like to call a function to get a value. Accordingly, I have put curly braces inside the case which ...
0
votes
1
answer
353
views
Switch-case alternative to test a subset of bits in an Option Set?
I have an Option set that I use to efficiently store various information about an object. I.e. the first 6 or so bits determine the "type", and several bits determine whether or not it is in certain ...
-1
votes
2
answers
215
views
How to access the main GUI thread from within a SWITCH statement?
I need to update the BG colour of a button from a delegate function, but when I try to access the main thread from inside the switch statement I get compiler errors.
Code as below
switch (peripheral....
0
votes
1
answer
2k
views
where must be break in switch objective-c
What is the difference between this solution:
switch (value)
{
case 1:
{
// some code
} break;
}
When break stay after brackets
And this:
switch (value)
{
case 1:
{
...
1
vote
1
answer
62
views
Switch statement nested format - which is correct?
I often use nested cases and I wrap them with { }. My question is which of these are correct? Both seems to work fine.
switch (yourMom) {
case 1: {
// so fat
}
break;
default:
break;
...
0
votes
1
answer
662
views
expressin is not an integer constant expression
I am using switch case into my method like in screenshot
I already done with Enumeration but how can I directly pass int constant into case??
I googled it but I found it with Enumeration
Please help ...
3
votes
1
answer
71
views
How to display two types of cells in UITableView without conflicts, but with the following requirement? [closed]
I have the following requirement to display data in a tableView as follows:
POST
POST
POST
CHANNEL CHANNEL CHANNEL ...(Each row has 6 channels)
POST
POST
POST
CHANNEL CHANNEL CHANNEL .....
For ...
0
votes
1
answer
84
views
Objective-C if vs switch [duplicate]
I can't understand why this works with if statement and not switch:
if ((int)typeOfHall == 1) {//LocalHall
NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"Game"];
...
0
votes
3
answers
1k
views
Using Enum and Switch on Objective-C
I have a view with 3 text fields:
Current password
New password
Confirm new password
The requirement is, to check the validity of these passwords, if the conditions are not satisfied, there will be ...
0
votes
3
answers
707
views
IOS expected expression error
I want to use an if-statement inside the switch but I keep getting an expected expression error. I would be grateful if anyone could help me to solve this issue.
switch ([ApplicationModel ...
0
votes
2
answers
430
views
Convert Swift convenience init with Switch statement to Objective-C
I am trying to convert this swift code to Objective-C
convenience init(fromString string: String, format:DateFormat)
{
if string.isEmpty {
self.init()
return
...
0
votes
2
answers
218
views
Is there a way to change a UIImageView's state from the App Delegate?
I have declared 4 images in the ViewDidLoad in my ViewController and then hide them with myImage1.hidden = YES;.
I was wondering if there was anyway of sending a message from the App Delegate (from ...