Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are alternatives for these controls in iPhone

Tags:

iphone

What are alternatives for these controls in iPhone

  • Radio Button
  • Check Box
  • Drop Down
  • x raise to Power y in UILabel
  • Hyperlink

Suggestion and answers will be appreciated, thanks.

like image 607
Shahab Qureshi Avatar asked Dec 13 '11 13:12

Shahab Qureshi


People also ask

Is there another way to access Control Center on iPhone?

To open Control Center, swipe down from the top-right corner of your screen. To close Control Center, swipe up from the bottom of the screen or tap the screen.

What are controls on iPhone?

Control Center on iPhone gives you instant access to useful controls—including airplane mode, Do Not Disturb, a flashlight, volume, screen brightness—and apps.


2 Answers

  • Radio Button: UISegmentedControl
  • Check Box: UISwitch
  • Drop Down: UIPickerView
  • x raise to Power y in UILabel: no such thing, you need to draw it yourself.
  • Hyperlink: Use a UILabel and attach a gesture recognizer for taps to it (or a custom type button)
like image 70
Eiko Avatar answered Oct 18 '22 02:10

Eiko


Almost all of these controls can be displayed using a UIWebView - if that's not an option, have a look at the UIWebView implementations and it should give you some kind of idea.

However, if you want native controls, these are probably the best options:

  • Radio Button: UISegmnetedControl
  • Check Box: UISwitch
  • Drop Down: UIPickerView (used in UIWebView).

x to the power of y in a UILabel is easy. Just replace your indices with unicode superscript characters... I use the following method to turn an integer into a string with superscript characters.

+(NSString *)convertIntToSuperscript:(int)i {
    NSArray *array = [[NSArray alloc] initWithObjects:@"⁰", @"¹", @"²", @"³", @"⁴", @"⁵", @"⁶", @"⁷", @"⁸", @"⁹", nil];
    if (i >= 0 && i <= 9) {
        NSString *myString = [NSString stringWithFormat:@"%@", [array objectAtIndex:i]];
        [array release];
        return myString;
    }
    else {
        NSString *base = [NSString stringWithFormat:@"%i", i];
        NSMutableString *newString = [[NSMutableString alloc] init];
        for (int b = 0; b<[base length]; b++) {
            int temp = [[base substringWithRange:NSMakeRange(b, 1)] intValue];
            [newString appendString:[array objectAtIndex:temp]];
        }
        [array release];
        NSString *returnString = [NSString stringWithString:newString];
        [newString release];
        return returnString;
    }    
}

For a hyperlink, use a UITextView with Property Inspector -> Detection -> Links enabled and Editable behavior disabled. Of course this is also available in a UIWebView.

like image 38
Alex Coplan Avatar answered Oct 18 '22 03:10

Alex Coplan