使用开关、分段控件和web视图

#import "XViewController.h"

@interface XViewController ()

@end

@implementation XViewController

- (void)viewDidLoad
{
    self.flowerDetailView.hidden=YES;
    [self getFlower:nil];
    [super viewDidLoad];

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)toggleFlowerDetail:(id)sender {
    self.flowerDetailView.hidden=![sender isOn];
}

- (IBAction)getFlower:(id)sender {
    NSURL *imageURL;
    NSURL *detailURL;
    NSString *imageURLString;
    NSString *detailURLString;
    NSString *color;
    int sessionID;

    color=[self.colorChoice titleForSegmentAtIndex:
           self.colorChoice.selectedSegmentIndex];

    sessionID=random()%50000;

    imageURLString=[[NSString alloc] initWithFormat:
             @"http://www.floraphotographs.com/showrandomios.php?color=%@&session=%d"
                    ,color,sessionID];

    detailURLString=[[NSString alloc] initWithFormat:
             @"http://www.floraphotographs.com/detailios.php?sessiono=%d"
                     ,sessionID];

    imageURL=[[NSURL alloc] initWithString:imageURLString];
    detailURL=[[NSURL alloc] initWithString:detailURLString];

    [self.flowerView loadRequest:[NSURLRequest requestWithURL:imageURL]];
    [self.flowerDetailView loadRequest:[NSURLRequest requestWithURL:detailURL]];

    self.flowerDetailView.backgroundColor=[UIColor clearColor];

}

@end

效果:

使用开关、分段控件和web视图

需要的输出口包括3项:

用于指定颜色打分段控件UISegmentedControl:colorChoice
用于显示

上一篇:easyui datagrid 列的内容超出所定义的列宽时,自动换行


下一篇:Java入门笔记 03-面向对象(上)