title: Displaying Integer value in a Label , int to String conversion?
body: <p>How to display an integer value in a <code>UILabel</code> in <code>ViewDidLoad</code>? I did for text and date and image but how to convert int to string. I was trying with following code</p>
  
  <pre><code> NSString* label=[aa stringWithFormat:@"%d",((Comments *) [self.list objectAtIndex:0]).noofcomm]]; 
   [self.comments2 setText:label];
  </code></pre>
  
  <p>but didn't work.Please help me.<strong>How to set with the Integer with UILabel?</strong></p>
  
  <p>This is my comments.h</p>
  
  <pre><code>    @interface Comments : NSObject
  {
      NSInteger iD;
      UIImage *photo;
      NSString *name;
      NSString *descrp;
      NSDate *date;
      NSString *msg;
      NSInteger noofcomm;
      NSInteger nooflikes;
  }
  @property(nonatomic,assign)NSInteger iD;
  @property(nonatomic,retain)UIImage *photo;
  @property(nonatomic,retain)NSString *name;
  @property(nonatomic,retain)NSString *descrp;
  @property(nonatomic,strong)NSDate *date;
  @property(nonatomic,retain)NSString *msg;
  @property(nonatomic,assign)NSInteger noofcomm;
  @property(nonatomic,assign)NSInteger nooflikes;
  
  
  @end
  </code></pre>
  
  <p>DBClass.m</p>
  
  <pre><code>     #import "DBClass.h"
  #import "Comments.h"
  
  @implementation DBClass
  - (NSMutableArray *) getMyComments{
      NSMutableArray *wineArray = [[NSMutableArray alloc] init];
      @try {
          NSFileManager *fileMgr = [NSFileManager defaultManager];
          NSString *dbPath = [[[NSBundle mainBundle] resourcePath ]stringByAppendingPathComponent:@"ComntDB.sqlite"];
          BOOL success = [fileMgr fileExistsAtPath:dbPath];
          if(!success)
          {
              NSLog(@"Cannot locate database file '%@'.", dbPath);
          }
          if(!(sqlite3_open([dbPath UTF8String], &amp;db) == SQLITE_OK))
          {
              NSLog(@"An error has occured.");
          }
          const char *sql = "SELECT id, photo,name,descrp, time,msg,comments,likes FROM Com";
          sqlite3_stmt *sqlStatement;
          if(sqlite3_prepare(db, sql, -1, &amp;sqlStatement, NULL) != SQLITE_OK)
          {
              NSLog(@"Problem with prepare statement");
          }
  
          //
          while (sqlite3_step(sqlStatement)==SQLITE_ROW) {
              Comments *MyWine = [[Comments alloc]init];
  
              MyWine.iD = sqlite3_column_int(sqlStatement, 0);
  
              const char *raw = sqlite3_column_blob(sqlStatement, 1);
              int rawLen = sqlite3_column_bytes(sqlStatement, 1);
              NSData *data = [NSData dataWithBytes:raw length:rawLen];
              MyWine.photo = [[UIImage alloc] initWithData:data];
              MyWine.name = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement,2)];
  
              MyWine.descrp = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement, 3)];
  
              MyWine.date=[NSDate dateWithTimeIntervalSince1970:sqlite3_column_double(sqlStatement,4)];
               MyWine.msg = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement,5)];
              MyWine.noofcomm = sqlite3_column_int(sqlStatement, 6);
              MyWine.nooflikes = sqlite3_column_int(sqlStatement, 7);
  
              [wineArray addObject:MyWine];
          }
      }
      @catch (NSException *exception) {
          NSLog(@"An exception occured: %@", [exception reason]);
      }
      @finally {
          return wineArray;
      }
  
  }
  
  @end
  </code></pre>
  
  <p>RootViewController.m</p>
  
  <pre><code>    #import "RootViewController.h"
  #import "Comments.h"
  #import "DBClass.h"
  
  @interface RootViewController ()
  
  @end
  
  @implementation RootViewController
  @synthesize list;
  @synthesize image2;
  @synthesize name2;
  @synthesize descrp2;
  @synthesize msg2;
  @synthesize date2;
  @synthesize comments2;
  @synthesize likes2;
  
  - (void)viewDidLoad
  {
      DBClass * mywines =[[DBClass alloc] init];
      self.list = [mywines getMyComments];
      [self.image2 setImage:((Comments *) [self.list objectAtIndex:0]).photo];
      [self.name2 setText:((Comments *) [self.list objectAtIndex:0]).name];
  
      [self.descrp2 setText:((Comments *) [self.list objectAtIndex:0]).descrp];
  
      NSDateFormatter* fmtr = [[NSDateFormatter alloc] init];
      [fmtr setDateFormat:@"MM/dd/yy"];
      NSString* label_str = [fmtr stringFromDate:((Comments *) [self.list objectAtIndex:0]).date];  
  [self.date2 setText:label_str];
            [self.msg2 setText:((Comments *) [self.list objectAtIndex:0]).msg];
      //[self.comments2 setText:((Comments *) [self.list objectAtIndex:0]).noofcomm];
         // int solution = 1;
  //    [self.comments2 setText:[NSString stringWithFormat:@"%d", solution]];
  //    int solution2 = 1;
  //    [self.likes2 setText:[NSString stringWithFormat:@"%d", solution2]];
  
      [super viewDidLoad];
  }
  - (void)viewDidUnload
  {
      [self setImage2:nil];
      [self setName2:nil];
      [self setMsg2:nil];
      [self setDescrp2:nil];
      [self setComments2:nil];
      [self setLikes2:nil];
      [self setDate2:nil];
      [super viewDidUnload];
  }
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  @end
  </code></pre>