ios - Adding Links to Buttons using Parse keys -
So I'm trying to open a link with a button using a query from parse. So the query works since the image and comes to the top. Keys "link" load even after NSLog. It's just that whenever the view is loaded, the first link in the list is automatically opened. I'm just wondering why I want it to load it when the button is pressed and when the footage is loaded. If there is any question, then I will try to answer them to clarify the problem. Thanks in advanced! (PFObject * homeObject in self.homeObjectArray) { Let's try: UIView * homeImage = [[UIView alloc] initWithFrame: CGRectMake (0, original, self .featuredScrollView. frame.size.width, 300)]; // imagePFFile * image = (PFFile *) [homeObject objectForKey: @ "imageFile"]; UIImageView * userImage = [[UIImageView alloc] initWithImage: [UIImage imageWithData: image.getData]]; UserImage.frame = CGRectMake (0, 0, homeImage.frame.size.width, 320); [Add home imageviewview: user image]; // Label UILabel * headingLabel = [[UILabel alloc] initWithFrame: CGRectMake (0, 325, homeImage.frame.size.width, 18)]; HeadingLabel.text = [homeObject objectForKey: @ "Heading"]; HeadingLabel.textcolor = [UIColor redColor]; HeadingLabel.textAlignment = NSTextAlignmentCenter; HeadingLabel.numberOfLines = 2; [Home image adview: heading label]; // link NSString * urlString = @ ""; UrlString = [homeObject objectForKey: @ "link"]; NSLog (@ "urls% @ \ n", URL string); NSDRL * URL = [[NSRL Alok] InitwithString: URL String]; UIButton * linkButton = [system with UIButton Button: UIButtonTypeCustom]; LinkButton = [[UIButton alloc] initWithFrame: userImage.frame]; [LinkButton addTarget: Self-action: [[UIApplication shared application] openURL: url] forControlEvents: UIControlEventTouchUpInside]; [Homeimage Aid Sueview: Linkbutton];
[linkButton addTarget : Self-action: @Selector (DotSoming) Control events: UI Control Event Touchup Inside]; - (zero) doSomthing {NSURL * url = [NSURL URLWithString: @ "http://stackoverflow.com/questions/23257429/adding-links-to-buttons-using-parse-keys"]; [[UIApplication shared application] Open URL: URL]; }
Comments
Post a Comment