Question

I have a view with 3 Container view inside, in two are picker, in the last one are 2 buttons. One of the button open a url, create by the two picker, and the other one refresh the link. If both pickers returns (null), the link work. If one of the picker return a value, and the refresh button is clicked, the link doesn't work anymore.

    - (void)viewDidLoad
 {
[super viewDidLoad];
// Do any additional setup after loading the view.

[_button_amazon_link setTitle:@"amazon.de" forState:UIControlStateNormal];
[_button_ifixit_link setTitle:@"ifixit.com" forState:UIControlStateNormal];

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

-(void) refreshview{
AppDelegate *appdelegatestrings = (AppDelegate *) [[UIApplication sharedApplication] delegate];

appdelegatestrings.link_amazon = [NSString stringWithFormat:@"http://www.amazon.com/s/field-keywords=%@+%@", appdelegatestrings.model, appdelegatestrings.dead_thing];

appdelegatestrings.link_ifixit = [NSString stringWithFormat:@"http://www.ifixit.com/Device/%@/%@", appdelegatestrings.model, appdelegatestrings.dead_thing];
link_ifixit_ready = appdelegatestrings.link_ifixit;
link_amazon_ready = appdelegatestrings.link_amazon;

}
-(void) openurl : (NSString *)urlstring
{
NSLog(urlstring);
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlstring]];
}
- (IBAction)button_amazon_link_clicked:(id)sender {
[self openurl:link_amazon_ready];

}
- (IBAction)button_ifixit_link_clicked:(id)sender {
[self openurl:link_ifixit_ready];
}

- (IBAction)button_refresh:(id)sender {
[self refreshview];
}
Was it helpful?

Solution

   -(IBAction)btn_press:(id)sender{
        [[UIApplication sharedApplication] openURL:[NSURL 
URLWithString:@"http://www.ifixit.com/Device/iPhone"]];
    }

This is working for me!!!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top