ryosaeb4 10 Posted February 21, 2012 Report Share Posted February 21, 2012 Ho realizzato una tableview con un cella custom tramite uno XIB in cui ho posizionato delle labels e un paio di immagini.Poi ho dichiarato nel file .h questo IBOutlet@property (strong, nonatomic) IBOutlet UITableViewCell *nibLoadedTableCell;Ed in .m questa porzione crea la tableview con la cella personalizzata://dichiaro la cella personalizzata e carico lo xib UITableViewCell *myCell = [tableView dequeueReusableCellWithIdentifier:@"Labeltv"]; if (myCell == nil) { /* // Load the top-level objects from the custom cell XIB. NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"Labeltv" owner:self options:nil]; // Grab a pointer to the first object (presumably the custom cell, as that's all the XIB should contain). myCell = [topLevelObjects objectAtIndex:0]; */ [[NSBundle mainBundle] loadNibNamed:@"Labeltv" owner:self options:nil]; myCell = nibLoadedTableCell; //GET ITEMS item = [entryArray objectAtIndex:indexPath.row]; //con questa dichiarazione riesco a puntare le label nella cella xib personalizzata UILabel *label = (UILabel *) [myCell viewWithTag:1]; UILabel *label1 = (UILabel *) [myCell viewWithTag:2]; UILabel *label2 = (UILabel *) [myCell viewWithTag:3]; label.text = item.titolo; label1.text = item.data; label2.text = item.descrizione; NSString *link; link = [item.urlImage stringByReplacingOccurrencesOfString:@" " withString:@""]; link = [link stringByReplacingOccurrencesOfString:@"\n" withString:@""]; link = [link stringByReplacingOccurrencesOfString:@" " withString:@""]; NSURL * imageURL = [NSURL URLWithString:link]; NSData * imageData = [NSData dataWithContentsOfURL:imageURL]; UIImage * image = [UIImage imageWithData:imageData]; //[[cell imageView] setImage:image]; [[myCell imageView] setImage:image]; } //return Cell; return myCell;}Ora ho un problema, quando scorro la tableview le celle si inceppano e ci mettono un po' a muoversi fluidamente.Cosa potrebbe essere? Tenete conto che ho fatto un parser di un XML remoto da cui prendo le informazioni per l'url dell'immagine, e i dati delle labels.Potrebbe essere un problema di connessione? Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now