Tutorial :segmented control in iPhone application



Question:

I've put UIsegment Control in my IPhone application.To load the pages I've this function - (void) segmentSelected:(id)segmentedCntl{ NSLog(@"Selected Segment Index = %d", [segmentedCntl selectedSegmentIndex]);
int index = [segmentedCntl selectedSegmentIndex];

ViewController *viewController = (ViewController *) controller;  NSString *xPath = [NSString stringWithFormat:@"item[%d]/a", (index + 1)];  NSArray *items = [element nodesForXPath:xPath error:nil];  if([items count] > 0){      CXMLElement *itemElement = (CXMLElement *) [items objectAtIndex:0];      NSString *url = [[itemElement attributeForName:@"href"] stringValue];      NSLog(@"url is &&&&&&&&&&&&&&&& %@", url);      if([url startsWith:@"#"]){      }else{          NSString *fullURL = [URLLoader getURL:url];          if(fullURL != nil){              if([fullURL contains:@"?"]){                  fullURL = [fullURL stringByAppendingString:@"&iPhoneMode=app"];              }else{                  fullURL = [fullURL stringByAppendingString:@"?iPhoneMode=app"];              }              [viewController showURL:fullURL cacheDuration:kPageCacheDuartion];                         }      }  }  

}

But the segmentControl is not clickable.Please help me to solve this problem


Solution:1

Namastey saikamesh

Please check proper u'r UISegmentControl property setting it will be working.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »