I am new to programming and very new to objective c so I apologize for any incorrect terminology, or possibly making an easy concept more difficult than it is.
I have two very simple integer arrays that I want to switch based on the current device
int iPhoneDevice[2] = {320,410};
int iPadDevice[2] = {768,1024};
How would I assign each array to a single variable based on the current device??? Along the same idea as this.
if([[CurrentDevice] isEqualToString:@"iphone"]) {
foo = iPhoneDevice[];
}else{
foo = iPadDevice[];
}
I need to be able to call both values of “foo” in my next conditional statement based on portrait. In my mind the logic would be similar to this.
if(orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
bar = foo[1];
}else {
bar = foo[0];
}
I have the intended result with an extra nested if, but I am trying to condense/clean up my code as much as possible. Any help would be appreciated. Thanks in advance.
1 Answer