- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. tripName = @"tripName"; // Create array to hold dictionaries myObject = [[NSMutableArray alloc] init]; NSData *jsonData = [NSData dataWithContentsOfURL: [NSURL URLWithString:@"http://localhost/www.letsgogoapp.com/apishowtablelocat.php"]]; id jsonObjects = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:nil]; // values in foreach loop for (NSDictionary *dataDict in jsonObjects) { NSString *strtripName = [dataDict objectForKey:@"tripName"]; dict = [NSDictionary dictionaryWithObjectsAndKeys: strtripName, tripName, nil]; [myObject addObject:dict]; } } -(NSInteger)numberOfSectionInTableView:(UITableView *)tableView { return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return myObject.count; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 300; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; recipeNewTripCell *cell = (recipeNewTripCell *) [tableView dequeueReusableCellWithIdentifier : CellIdentifier]; if (cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"recipeNewTripCell" owner:self options:nil]; cell = [nib objectAtIndex:0]; } NSDictionary *tmpDict = [myObject objectAtIndex:indexPath.row]; cell.showTripName.text = [tmpDict objectForKey:tripName]; return cell; }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง