Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to set same Size images in Table View?
    text
    copied!<p>I am new to iPhone I am creating an application which display the name of countries and Theirs flag as a thumbnail., The problem is the size of all all images are not same so there is unpredictable output. </p> <p>Code Is Given Below</p> <h1>.h file</h1> <pre><code>IBOutlet UILabel *countryLabel; IBOutlet UIImageView *thumbnailView; IBOutlet UILabel *populationLable; </code></pre> <h1> .m File</h1> <pre><code>#import "TextFieldAlertViewController.h" @implementation TextFieldAlertViewController - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [tableData count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *simpleTableIdentifier = @"SimpleTableItem"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier]; } cell.textLabel.text = [tableData objectAtIndex:indexPath.row]; cell.imageView.image = [UIImage imageNamed:[thumbnails objectAtIndex:indexPath.row]]; return cell; } - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)loadView { } - (void)viewDidLoad { [super viewDidLoad]; tableData = [NSArray arrayWithObjects:@"Australia", @"Brazil",@"China", @"Denmark", @"England", @"France", @"Germany", @"Hong Kong", @"India", @"Japan", @"Korea", @"Labanon", @"Malasiya", @"Niegiria", @"Peru", @"Swidden", nil]; thumbnails = [NSArrayarrayWithObjects:@"aus.png",@"br.png",@"ch.png",@"dk.png",@"eng.png",@"fr.png", @"ger.png",@"hk.png",@"in.png",@"jp.png",@"ko.png",@"lb.png",@"my.png",@"ng.png",@"pe.png",@"sw.png",nil]; } -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } - (void)viewDidUnload { } - (void)dealloc { [super dealloc]; } @end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload