Skip to main content

All 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() ...
Sazzad Hissain Khan's user avatar
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 ...
pkamb's user avatar
  • 34.6k
-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 ...
user avatar
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 ...
user6631314's user avatar
  • 1,868
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 ...
Jake T.'s user avatar
  • 4,378
-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....
Matt Douhan's user avatar
  • 2,103
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: { ...
Tony.Y.'s user avatar
  • 13
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; ...
GeneCode's user avatar
  • 7,580
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 ...
Jitendra Modi's user avatar
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 ...
KSR's user avatar
  • 1,709
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"]; ...
ePascoal's user avatar
  • 2,422
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 ...
Duy Khanh Nguyen's user avatar
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 ...
AOY's user avatar
  • 355
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 ...
user avatar
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 ...
hbondy's user avatar
  • 13

15 30 50 per page
1
2 3 4 5
12