in this block of code my uiimageview always get nil.as a result the code crashes.i can t figure out where is the uiimageview getting nil.in this code self refers to uitableviewcell.
the code crashes in the code where i am inserting the imageview to the array.is this a problem of memory retain?
MyAppDelegate *appDelegate =(myAppDelegate *)[[UIApplication sharedApplication]delegate];
UIImageView *profileImageView;
UILabel *tweetLabel;
UILabel *timeLabel;
UILabel *profileNameLabel;
UIView *message;
if(self==nil)
{
profileImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
profileImageView.backgroundColor= [UIColor clearColor];
profileImageView.tag = 1;
tweetLabel = [[UILabel alloc] initWithFrame:CGRectZero];
tweetLabel.backgroundColor = [UIColor clearColor];
tweetLabel.tag = 2;
tweetLabel.numberOfLines = 3;
tweetLabel.lineBreakMode = UILineBreakModeWordWrap;
tweetLabel.font = [UIFont systemFontOfSize:10.0];
tweetLabel.textColor=[UIColor blackColor];
timeLabel = [[UILabel alloc] initWithFrame:CGRectZero];
timeLabel.backgroundColor = [UIColor clearColor];
timeLabel.tag = 3;
timeLabel.numberOfLines = 1;
timeLabel.lineBreakMode = UILineBreakModeWordWrap;
timeLabel.font = [UIFont systemFontOfSize:12.0];
timeLabel.textColor=[UIColor blackColor];
profileNameLabel = [[UILabel alloc] initWithFrame:CGRectZero];
profileNameLabel.backgroundColor = [UIColor clearColor];
profileNameLabel.tag = 4;
profileNameLabel.numberOfLines = 1;
profileNameLabel.lineBreakMode = UILineBreakModeWordWrap;
profileNameLabel.font = [UIFont boldSystemFontOfSize:14.0];
profileNameLabel.textColor=[UIColor blackColor];
message = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.frame.size.width, self.frame.size.height)];
message.tag = 0;
[message addSubview:profileImageView];
[message addSubview:tweetLabel];
[message addSubview:timeLabel];
[message addSubview:profileNameLabel];
[self addSubview:message];
}
else{
tweetLabel = (UILabel *)[[self.contentView viewWithTag:0]viewWithTag:2];
timeLabel = (UILabel *)[[self.contentView viewWithTag:0]viewWithTag:3];
profileNameLabel = (UILabel *)[[self.contentView viewWithTag:0]viewWithTag:4];
profileImageView = (UIImageView *)[self.contentView viewWithTag:1];
NSLog(#" profileImageView %#",profileImageView);
}
NSString *tweet=[tweetObject tweet];
NSString *profileName=[tweetObject author];
NSString *time=[tweetObject time];
CGSize textSize = [tweet sizeWithFont:[UIFont systemFontOfSize:14.0] constrainedToSize:CGSizeMake(240.0f, 480.0f) lineBreakMode:UILineBreakModeWordWrap];
CGSize timeSize = [time sizeWithFont:[UIFont systemFontOfSize:14.0] constrainedToSize:CGSizeMake(240.0f, 480.0f) lineBreakMode:UILineBreakModeWordWrap];
CGSize profileNameSize = [profileName sizeWithFont:[UIFont boldSystemFontOfSize:14.0] constrainedToSize:CGSizeMake(240.0f, 480.0f) lineBreakMode:UILineBreakModeWordWrap];
profileImageView.frame = CGRectMake(5,self.frame.size.height/2, 44, 44);
NSLog(#" profileImageView %#",profileImageView);
tweetLabel.frame = CGRectMake(54, profileImageView.frame.size.width, 240,25);
timeLabel.frame = CGRectMake(180, 5.0f, 100, timeSize.height);
profileNameLabel.frame = CGRectMake(54,5, 150, profileNameSize.height);
tweetLabel.text=tweet;
timeLabel.text=time;
profileNameLabel.text=profileName;
profileImageView.image = [[UIImage imageNamed:#"fbdefaultProfile.gif"]retain];
NSLog(#" myArray WILL FILL WITH THIS ELEMNTS %# %# %# ",profileImageView,[tweetObject imageURL],#"fbdefaultProfile.gif");
NSArray *myArray = [NSArray arrayWithObjects:profileImageView,[tweetObject imageURL],#"fbdefaultProfile.gif",nil];
NSLog(#" myArray %#",myArray);
NSLog(#"%# myArray ",myArray);
[appDelegate performSelectorInBackground:#selector(updateImageViewInBackground:) withObject:myArray];
}
return;
if(self==nil)
{
what is this.. I think it should be
if(self!=nil)
{
and if it is fine then why are you adding subview to a nill
if(self==nil)
{
//your code .....
//and then you are adding sub view to a nil which is useless
[self addSubview:message];
}
The issue could be in the below line of code.
profileImageView = (UIImageView *)[self.contentView viewWithTag:1];
May be you don't have the an view with tag id 1;
plz check against nil after getting the view from viewWithTag.
if([self.contentView viewWithTag:1] != nil)
{
profileImageView = (UIImageView *)[self.contentView viewWithTag:1];
}
Related
I have created more than one label using this code,
.H file
#interface ViewController : UIViewController
{
NSArray * phraseAry ;
UIView * containerView;
UILabel * oldLabel;
NSMutableArray *dataArray;
}
#property (strong, nonatomic) IBOutlet UIScrollView *myScrollView;
.M file
- (void)viewDidLoad
{
[super viewDidLoad];
heightValue = 20;
widthValue = 0;
xValue = 5;
yValue = 10;
containerView = [[UIView alloc] init];
for (int i=0; i<phraseAry.count; i++) {
widthValue = [self returnWidth:[phraseAry objectAtIndex:i]];
int newXValue = xValue+widthValue+5;
//NSLog(#"newXValue : %i",newXValue);
if (newXValue > 310) {
yValue +=20;
xValue = 5;
newXValue = xValue+widthValue+5;
UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(xValue, yValue, widthValue, heightValue)];
lbl.text = [phraseAry objectAtIndex:i];
[lbl setFont:[UIFont fontWithName:#"Helvetica" size:14.0]];
lbl.tag = i;
lbl.textColor = [UIColor colorWithRed:(92/255.0) green:(109/255.0) blue:(43/255.0) alpha:1];
[containerView addSubview:lbl];
xValue = newXValue;
} else {
UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(xValue, yValue, widthValue, heightValue)];
lbl.text = [phraseAry objectAtIndex:i];
[lbl setFont:[UIFont fontWithName:#"Helvetica" size:14.0]];
lbl.tag = i;
lbl.textColor = [UIColor colorWithRed:(92/255.0) green:(109/255.0) blue:(43/255.0) alpha:1];
[containerView addSubview:lbl];
xValue = newXValue;
}
}
containerView.frame = CGRectMake(0, 0, 320, yValue);
//add code to customize, e.g. polygonView.backgroundColor = [UIColor blackColor];
[self.myScrollView addSubview:containerView];
self.myScrollView.contentSize = containerView.frame.size;
}
And than i set background color and textcolor in specific table using this code
- (void)updateLabelMethod
{
oldLabel.backgroundColor = [UIColor clearColor];
UILabel *label = (UILabel *)[containerView viewWithTag:2];
oldLabel = label;
label.backgroundColor = [UIColor colorWithRed:(98/255.0) green:(147/255.0) blue:(216/255.0) alpha:1];
label.textColor = [UIColor whiteColor];
containerView.backgroundColor = [UIColor clearColor];
}
It will update background of label fine but when i use this code to update textcolor it will display error like this
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setTextColor:]: unrecognized selector sent to instance 0xbaa3b30'
Any ways to set textcolor? Plz help.
Start your label tag from 1 instead of 0, because by default the tag value is 0 for all view.
lbl.tag = i+1;
Because
UILabel *label = (UILabel *)[containerView viewWithTag:0];
it will return containerView itself, and UIView not have textColor property :P
[containerView viewWithTag:2];
check container view has only one view that is a label with tag 2.
May be some other view is set with tag 2 and may be causing the issue.
NSLog(#"%#",label);
can give you what the label here gives the output .It should point out an UILabel itself
make use of isKindOfClass: to identify it is a label you are updating
for (UILable *lblTemp in containerView.subviews){
if ([lblTemp isKindOfClass:[UILable class]] && lblTemp.tag==2){
// change the lbl color
break;
}
}
check using this code ;)
Hello all,
I have to add one more view in cell of GMGridView. But i am unable to do this because i have to drag my label from view to view1.
My code is :
- (GMGridViewCell *)GMGridView:(GMGridView *)gridView1 cellForItemAtIndex:(NSInteger)index
{
// set size based on orientation
CGSize size = [self GMGridView:gridView sizeForItemsInInterfaceOrientation:[[UIApplication sharedApplication] statusBarOrientation]];
GMGridViewCell *cell = [gridView dequeueReusableCell];
if (!cell)
{
cell = [[[GMGridViewCell alloc]init]autorelease];
//one view
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
view.backgroundColor = [UIColor redColor];
view.layer.masksToBounds = NO;
view.layer.cornerRadius = 2;
cell.contentView = view;
//another view
UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(0, 80, size.width, size.height)];
view1.backgroundColor = [UIColor yellowColor];
view1.layer.masksToBounds = NO;
view1.layer.cornerRadius = 2;
cell.contentView = view1;
}
[[cell.contentView subviews] makeObjectsPerformSelector:#selector(removeFromSuperview)];
// allocate label
UILabel *label = [[UILabel alloc] initWithFrame:cell.contentView.bounds];
label.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
label.text = (NSString *)[self.currentData objectAtIndex:index];
label.textAlignment = UITextAlignmentCenter;
label.backgroundColor = [UIColor clearColor];
label.textColor = [UIColor blackColor];
label.font = [UIFont boldSystemFontOfSize:20];
[cell.contentView addSubview:label];
return cell;
}
height of cell is 200. but still it shows only one view.
Loading Two types of Cell in GMGridView
This is your Solution, it works as charm..
First Do this Exactly
-(void)prepareExhibitor
{
NSInteger spacing = 1.0;
CGRect rect=self.view.frame;
rect.origin=CGPointMake(0, 0);
self.gmGridView = [[GMGridView alloc] initWithFrame:rect];
self.gmGridView.backgroundColor = [UIColor clearColor];
self.gmGridView.centerGrid=NO;
self.gmGridView.style = GMGridViewStylePush;
self.gmGridView.layoutStrategy = [GMGridViewLayoutStrategyFactory strategyFromType:GMGridViewLayoutHorizontal];
self.gmGridView.showsHorizontalScrollIndicator=FALSE;
self.gmGridView.clipsToBounds=YES;
self.gmGridView.itemSpacing = spacing;
self.gmGridView.minEdgeInsets = UIEdgeInsetsMake(0,30, 0, 0);
[self.viewNewsHeadline addSubview:self.gmGridView];
self.gmGridView.actionDelegate = self;
self.gmGridView.dataSource = self;
self.gmGridView.mainSuperView = self.superView;
}
Then Write this accordingly as per your Code
- (GMGridViewCell *)GMGridView:(GMGridView *)gridView cellForItemAtIndex:(NSInteger)index
{
GMGridViewCell *cell = [gridView dequeueReusableCell];
NewsCell_iPad *view;
UIViewController *controller;
if (!cell)
{
// [self removeGrid];
cell = [[GMGridViewCell alloc] init];
if(index%2==0)
{
controller=[[UIViewController alloc] initWithNibName:#"NewsCellTypeA_iPad" bundle:nil];
}
else
{
controller=[[UIViewController alloc] initWithNibName:#"NewsCellTypeB_iPad" bundle:nil];
}
if(!view)
{
view=(NewsCell_iPad *)controller.view;
}
cell.layer.masksToBounds = NO;
cell.contentView = view;
}
NewsCell_iPad *newsView=(NewsCell_iPad *)cell.contentView;
newsView.news=[self.arrNews objectAtIndex:index];
[self hideGradientBackground:newsView.webViewDetailedNews];
[newsView downloadImage];
[newsView loadWebView];
// NSLog(#"cell=%d ,arr image index=%#",index,[self.arrNews objectAtIndex:index]);
return cell;
}
I've got a label which is displayed in a subview. I got the text of the label from a NSString on parse. However, I tried to display the text but it doesnt seems to work. There is no text displayed.
Here is my code. Please let me know if you know how to solve this:
PFQuery *query = [PFQuery queryWithClassName:#"myapp"];
[query getObjectInBackgroundWithId:#"myId"
block:^(PFObject *textu, NSError *error) {
if (!error) {
CGRect infoLabelRect = CGRectMake(10, 250, 260, 350);
UILabel *infoLabel = [[UILabel alloc] initWithFrame:infoLabelRect];
NSString *text = [textu objectForKey:#"newstext"];
UIFont *font = nil;
CGFloat points = 17;
CGFloat maxHeight = infoLabel.frame.size.height;
CGFloat textHeight;
do {
font = [UIFont systemFontOfSize:points];
CGSize size = CGSizeMake(infoLabelRect.size.width, 100000);
CGSize textSize = [text sizeWithFont:font constrainedToSize:size lineBreakMode: NSLineBreakByWordWrapping];
textHeight = textSize.height;
points -= 1;
} while (textHeight > maxHeight);
infoLabel.font = font;
infoLabel.numberOfLines = 9;
infoLabel.textColor = [UIColor whiteColor];
infoLabel.textAlignment = NSTextAlignmentCenter;
infoLabel.backgroundColor = [UIColor clearColor];
infoLabel.shadowColor = [UIColor blackColor];
infoLabel.shadowOffset = CGSizeMake(0, 1);
[infoLabel sizeToFit];
[contentView addSubview:infoLabel];
} else {
// Log details of our failure
CGRect infoLabelRect = CGRectMake(10, 250, 260, 350);
UILabel *infoLabel = [[UILabel alloc] initWithFrame:infoLabelRect];
infoLabel.text = #"Connection error!";
}
}];
Your first part of code doesn't contain assignment to text
infoLabel.text = text; // or #"Some text" for testing
Your last part of code only creates UILabel, but doesn't add it as subview
UILabel *infoLabel = [[UILabel alloc] initWithFrame:infoLabelRect];
infoLabel.text = #"Connection error!";
[contentView addSubview:infoLabel];
HI,
I am using the following code for displaying data dynamically on a label.ITs working fine.But sometimes the content is overlapping with the subhead title and description.Please help me in this.I am not able to trace out this.THANKS IN ADVANCE
for (int i=0; i<[article.subheadArray count]; i++) {
//subhead Title
subheadTitle = [[UILabel alloc] initWithFrame:CGRectMake(xoffset, yoffset+total, 320-xoffset, 300+lblheight)];
subheadTitle.backgroundColor=[UIColor clearColor];
//subheadTitle.textColor=[UIColor blueColor];
[subheadTitle setFont: [UIFont fontWithName:#"Arial-BoldMT" size:17]];
subheadTitle.textColor = [UIColor colorWithRed:45.0/255.0 green:99.0/255.0 blue:03.0/255.0 alpha:1];
subHead = [article.subheadArray objectAtIndex:i];
expectedLabelSize = [subHead.Title sizeWithFont:subheadTitle.font
constrainedToSize:maximumLabelSize
lineBreakMode:subheadTitle.lineBreakMode];
newFrame = subheadTitle.frame;
newFrame.size.height=expectedLabelSize.height;
subheadTitle.frame=newFrame;
total+=expectedLabelSize.height+yoffset;
NSLog(#"%# %d",subHead.Title,total);
subheadTitle.numberOfLines=0;
subheadTitle.text=subHead.Title;
[scrollView addSubview:subheadTitle];
//subhead Description
subheadlabel = [[UILabel alloc] initWithFrame:CGRectMake(xoffset, yoffset+total, 320-xoffset, 300+lblheight)];
subheadlabel.backgroundColor=[UIColor clearColor];
subHead = [article.subheadArray objectAtIndex:i];
//subheadlabel.font = [UIFont italicSystemFontOfSize:fontsize];
[subheadlabel setFont: [UIFont fontWithName:#"ArialMT" size:fontsize]];
expectedLabelSize=[subHead.Description sizeWithFont:subheadlabel.font
constrainedToSize:maximumLabelSize
lineBreakMode:subheadlabel.lineBreakMode];
newFrame = subheadlabel.frame;
newFrame.size.height=expectedLabelSize.height;
subheadlabel.frame=newFrame;
total+=expectedLabelSize.height+yoffset;
subheadlabel.text = subHead.Description;
NSLog(#"subhead desc: %d %d",total,subheadlabel.numberOfLines);
subheadlabel.numberOfLines =0;
[subheadlabel sizeToFit];
[scrollView addSubview:subheadlabel];
//Adding subhead label to subheadlabelarr
[subheadlabelarr addObject:subheadTitle];
//subhead Image
for (int j=0; j<[subHead.imageArray count]; j++) {
Image* image = [subHead.imageArray objectAtIndex:j];
UIImage* uiImage = [XMLParsing getImagewithName:image.Name];
CGSize imageSize = uiImage.size;
if(imageSize.width>=300){
width = 300;
}
else {
width = imageSize.width;
}
if(imageSize.height>=200){
height = 200;
}else {
height = imageSize.height;
}
imageView = [[UIImageView alloc] initWithFrame:CGRectMake((320-width)/2,yoffset+total,width,height)];
//imageView = [[UIImageView alloc] initWithFrame:CGRectMake(200, yoffset+total, width, height)];
imageView.clipsToBounds = YES;
total+=imageView.frame.size.height+yoffset;
//************cell.myImageView.image=[XMLParser getImagewithName:#"og_logo.png"];
imageView.image = [XMLParsing getImagewithName:image.Name];
[scrollView addSubview:imageView];
}
}
I think both subheadTitle and subheadlabel will overlaps because of their frame. Can you check the values of expectedLabelSize in both cases.
there are 3 settings, in my app, that can be change the drawing of a cell.
By default, a cell of my table view show the name and the cost of an object... Changing these 3 setting, an user can choose to show a description or a link insted of cost.
I wrote a lot of code and now, my app can change cell's drawing without quit from it...
My problem is the drawing is changed only for new objects added but old objects don't change!
How can I do to change also the old cell's drawing without quit from app?
This is the code of my cell (i'm using setNeedsDisplay and drawRect methods):
#import "WishTableCell.h"
#implementation WishTableCell
#synthesize wish;
#synthesize imageView;
#synthesize nomeLabel;
#synthesize label;
#synthesize costoLabel;
#synthesize linkDescLabel;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
imageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 11, 28, 28)];
imageView.contentMode = UIViewContentModeCenter;
[self.contentView addSubview:imageView];
nomeLabel = [[UILabel alloc] initWithFrame:CGRectMake(58, 8, 235, 22)];
[self.contentView addSubview:nomeLabel];
if ([NSLocalizedString(#"CostoCella", #"") isEqualToString:#"Costo:"]) {
label = [[UILabel alloc] initWithFrame:CGRectMake(58, 28, 40, 16)];
}
else {
label = [[UILabel alloc] initWithFrame:CGRectMake(58, 28, 35, 16)];
}
[self.contentView addSubview:label];
if ([NSLocalizedString(#"CostoCella", #"") isEqualToString:#"Costo:"]) {
costoLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 28, 185, 16)];
}
else {
costoLabel = [[UILabel alloc] initWithFrame:CGRectMake(93, 28, 195, 16)];
}
[self.contentView addSubview:costoLabel];
linkDescLabel = [[UILabel alloc] initWithFrame:CGRectMake(58, 28, 235, 16)];
[self.contentView addSubview:linkDescLabel];
self.backgroundView = [[UIImageView alloc] init];
UIImage *rowBackground = [UIImage imageNamed:#"cellBg.png"];
((UIImageView *)self.backgroundView).image = rowBackground;
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
-(void)setWish:(Wish *)newWish {
if (newWish != wish) {
[wish release];
wish = [newWish retain];
}
[self setNeedsDisplay];
}
-(void)drawRect:(CGRect)rect {
NSLog(#"DrawRect called!");
nomeLabel.text = wish.nome;
nomeLabel.font = [UIFont boldSystemFontOfSize:18.0];
nomeLabel.textColor = [UIColor colorWithRed:0.039 green:0.4 blue:0.737 alpha:1.0];
nomeLabel.textAlignment = UITextAlignmentLeft;
nomeLabel.shadowColor = [UIColor whiteColor];
nomeLabel.shadowOffset = CGSizeMake(0, 1);
nomeLabel.backgroundColor = [UIColor clearColor];
label.font = [UIFont boldSystemFontOfSize:12.0];
label.text = NSLocalizedString(#"CostoCella", #"");
label.textColor = [UIColor colorWithRed:0.262 green:0.258 blue:0.258 alpha:1.0];
label.textAlignment = UITextAlignmentLeft;
label.shadowColor = [UIColor whiteColor];
label.shadowOffset = CGSizeMake(0, 1);
label.backgroundColor = [UIColor clearColor];
costoLabel.font = [UIFont boldSystemFontOfSize:12.0];
costoLabel.textColor = [UIColor colorWithRed:0.262 green:0.258 blue:0.258 alpha:1.0];
costoLabel.textAlignment = UITextAlignmentLeft;
costoLabel.shadowColor = [UIColor whiteColor];
costoLabel.shadowOffset = CGSizeMake(0, 1);
costoLabel.backgroundColor = [UIColor clearColor];
linkDescLabel.font = [UIFont boldSystemFontOfSize:12.0];
linkDescLabel.textColor = [UIColor colorWithRed:0.262 green:0.258 blue:0.258 alpha:1.0];
linkDescLabel.textAlignment = UITextAlignmentLeft;
linkDescLabel.shadowColor = [UIColor whiteColor];
linkDescLabel.shadowOffset = CGSizeMake(0, 1);
linkDescLabel.backgroundColor = [UIColor clearColor];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([[defaults objectForKey:#"dettagliView"] isEqualToString:#"costoView"]) {
linkDescLabel.hidden = YES;
label.hidden = NO;
costoLabel.hidden = NO;
if ([[defaults objectForKey:#"valutaCosto"] isEqualToString:#"Euro"]) {
NSString *costo = [[NSString alloc] initWithFormat:#"€ %#", wish.costo];
costoLabel.text = costo;
}
if ([[defaults objectForKey:#"valutaCosto"] isEqualToString:#"Dollaro"]) {
NSString *costo = [[NSString alloc] initWithFormat:#"$ %#", wish.costo];
costoLabel.text = costo;
}
if ([[defaults objectForKey:#"valutaCosto"] isEqualToString:#"Sterlina"]) {
NSString *costo = [[NSString alloc] initWithFormat:#"£ %#", wish.costo];
costoLabel.text = costo;
}
}
else if ([[defaults objectForKey:#"dettagliView"] isEqualToString:#"descrizioneView"]) {
label.hidden = YES;
costoLabel.hidden = YES;
linkDescLabel.hidden = NO;
linkDescLabel.text = wish.descrizione;
}
else if ([[defaults objectForKey:#"dettagliView"] isEqualToString:#"urlView"]) {
label.hidden = YES;
costoLabel.hidden = YES;
linkDescLabel.hidden = NO;
linkDescLabel.text = wish.link;
}
if (wish.categoria == nil)
imageView.image = [UIImage imageNamed:#"personale.png"];
if ([wish.categoria isEqualToString:#"Abbigliamento"])
imageView.image = [UIImage imageNamed:#"abbigliamento.png"];
else if ([wish.categoria isEqualToString:#"Casa"])
imageView.image = [UIImage imageNamed:#"casa.png"];
else if ([wish.categoria isEqualToString:#"Cibo"])
imageView.image = [UIImage imageNamed:#"cibo.png"];
else if ([wish.categoria isEqualToString:#"Divertimento"])
imageView.image = [UIImage imageNamed:#"divertimento.png"];
else if ([wish.categoria isEqualToString:#"Elettronica"])
imageView.image = [UIImage imageNamed:#"elettronica.png"];
else if ([wish.categoria isEqualToString:#"Hobby"])
imageView.image = [UIImage imageNamed:#"hobby.png"];
else if ([wish.categoria isEqualToString:#"Internet"])
imageView.image = [UIImage imageNamed:#"internet.png"];
else if ([wish.categoria isEqualToString:#"Regali"])
imageView.image = [UIImage imageNamed:#"regali.png"];
else if ([wish.categoria isEqualToString:#"Ufficio"])
imageView.image = [UIImage imageNamed:#"ufficio.png"];
else if ([wish.categoria isEqualToString:#"Viaggi"])
imageView.image = [UIImage imageNamed:#"viaggi.png"];
else if ([wish.categoria isEqualToString:#"Personale"])
imageView.image = [UIImage imageNamed:#"personale.png"];
}
- (void)dealloc {
[wish release];
[imageView release];
[nomeLabel release];
[costoLabel release];
[linkDescLabel release];
[label release];
[super dealloc];
}
#end
Thanks a lot for the attention!
Matthew
Try to call [NSTableView reloadData] function, and set the drawing properties in the delegate method (cellForRowAtIndexPath).
I think that you also can use interface to create the cell (.xib), then you do not need write so many assign property code....