Search Results

Search found 3 results on 1 pages for 'ohhmee'.

Page 1/1 | 1 

  • App is crashing as soon as UITableView gets reloaded

    - by OhhMee
    Hello, I'm developing an app where TableView needs to reload as soon as the login process gets completed. The app crashes with error EXC_BAD_ACCESS when the table data gets reloaded. It doesn't crash when I remove all case instances except case 0: What could be the reason behind it? Here's the code: - (void)viewDidLoad { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginDone:) name:@"loginDone" object:nil]; statTableView.backgroundColor = [UIColor clearColor]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger) section { return 6; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } // Configure the cell. switch (indexPath.row) { case 0 : cell.textLabel.text = @"Foo:"; NSLog(@"%@", data7); UILabel *myLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(200, 10, 20, 30)]; myLabel2.text = (@"%@", data7); myLabel2.textColor = [UIColor blackColor]; myLabel2.backgroundColor = [UIColor whiteColor]; myLabel2.font = [UIFont fontWithName:@"Trebuchet MS" size:14]; [cell.contentView addSubview:myLabel2]; break; case 1: cell.textLabel.text = @"Foo: "; UILabel *myLabel4 = [[UILabel alloc] initWithFrame:CGRectMake(200, 10, 20, 30)]; myLabel4.text = (@"%@", data11); myLabel4.textColor = [UIColor blackColor]; myLabel4.backgroundColor = [UIColor whiteColor]; myLabel4.font = [UIFont fontWithName:@"Trebuchet MS" size:14]; [cell.contentView addSubview:myLabel4]; break; case 2: cell.textLabel.text = @"Foo: "; UILabel *myLabel8 = [[UILabel alloc] initWithFrame:CGRectMake(200, 10, 20, 30)]; myLabel8.text = (@"%@", data3); myLabel8.textColor = [UIColor blackColor]; myLabel8.backgroundColor = [UIColor whiteColor]; myLabel8.font = [UIFont fontWithName:@"Trebuchet MS" size:14]; [cell.contentView addSubview:myLabel8]; break; case 3: cell.textLabel.text = @"Foo: "; UILabel *myLabel10 = [[UILabel alloc] initWithFrame:CGRectMake(200, 10, 20, 30)]; myLabel10.text = [NSString stringWithFormat:@"%@", data4]; if ([data4 isEqualToString:@"0"]) { myLabel10.text = @"None"; } myLabel10.textColor = [UIColor blackColor]; myLabel10.backgroundColor = [UIColor whiteColor]; myLabel10.font = [UIFont fontWithName:@"Trebuchet MS" size:14]; [cell.contentView addSubview:myLabel10]; break; case 4: cell.textLabel.text = @"Foo: "; UILabel *myLabel12 = [[UILabel alloc] initWithFrame:CGRectMake(200, 10, 20, 30)]; myLabel12.text = [NSString stringWithFormat:@"%@", data5]; myLabel12.textColor = [UIColor blackColor]; if ([data5 isEqualToString:@"Foo"]) { myLabel12.textColor = [UIColor redColor]; myLabel12.text = @"Nil"; } myLabel12.backgroundColor = [UIColor whiteColor]; myLabel12.font = [UIFont fontWithName:@"Trebuchet MS" size:14]; [cell.contentView addSubview:myLabel12]; break; case 5: cell.textLabel.text = @"Foo: "; UILabel *myLabel14 = [[UILabel alloc] initWithFrame:CGRectMake(200, 10, 50, 30)]; if ([data6 isEqualToString:@"Foo"]) { myLabel14.textColor = [UIColor colorWithRed:(0/255.f) green:(100/255.f) blue:(0/255.f) alpha:1.0]; myLabel14.text = @"No Dues"; } else { myLabel14.text = [NSString stringWithFormat:@"%@", data6]; myLabel14.textColor = [UIColor redColor]; } myLabel14.backgroundColor = [UIColor whiteColor]; myLabel14.font = [UIFont fontWithName:@"Trebuchet MS" size:14]; [cell.contentView addSubview:myLabel14]; break; /* [myLabel2 release]; [myLabel4 release]; [myLabel8 release]; [myLabel10 release]; [myLabel12 release]; [myLabel14 release]; */ } return cell; }

    Read the article

  • Make an NSString accessible in the whole class

    - by OhhMee
    Hello, I want to know how can I make an NSString accessible in the whole class. Say I have these codes: - (void) init { NSArray *elements = [xpathParser search:@"//foo"]; TFHppleElement *element = [elements objectAtIndex:0]; NSString *data = [element content]; NSArray *elements1 = [xpathParser search:@"//foo2"]; TFHppleElement *element2 = [elements1 objectAtIndex:0]; NSString *data2 = [element2 content]; } And I want to use data & data2 in the whole class, how can I do that? I want to show results here: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } // Configure the cell. switch (indexPath.row) { case 0 : cell.textLabel.text = (@"%@", data); break; case 1: cell.textLabel.text = (@"%@", data2); break; } // Email & Password Section return cell; }

    Read the article

  • Content Alignment Issue in UITableView cell

    - by OhhMee
    Please see the image attached. I don't understand why it's going outside. I've also attached code snippet for tableView. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; // cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; } // Configure the cell. hNode* dCell = [array objectAtIndex:[indexPath row]]; cell.textLabel.text = @"Message"; cell.detailTextLabel.text = [NSString stringWithFormat:@"%@",[dCell contents]]; cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap; cell.detailTextLabel.numberOfLines = 0; [[cell imageView] setImage:[UIImage imageNamed:@"user.png"]]; return cell; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath { return 60; } Where could be the issue?

    Read the article

1