iphone - Custom UIButton with UIImageView doesn't work fine on device -


My problem is that I have a custom button and imageview on which I added the image. I created this image in a custom button, a subview. When Im running it in the simulator, it works fine, but when I run it on the device, it was not displaying the image in the button.

I have written the code as:

In CellForRowtIndexPath

  - (UITableViewCell *) TableView: (UITableView *) TV CellphoneAutindAppath: ( NSIndexPath *) Index Path {UITableViewCell * cell = [Tableview dequeueReusableCellWithIdentifier: @ "MasterViewIdentifier"]; If (cell == blue) {cell = [[[UTTable watch alloc] initWithFrame: CGRectZero reuseIdentifier: @ "MasterViewIdentifier"] autorelease]; Cell.selectionStyle = UITableViewCellSelectionStyleNone; UIView * elementView = [[UIView alloc] initWithFrame: CGRectMake (20,170,320,280)]; ElementView.tag = 0; ElementView.backgroundColor = [UIColor clear collar]; [Cell.contentView addSubview: elementView]; [ElementView release]; } UIView * elementView = [cell.contentView View Tutorial: 0]; ElementView.backgroundColor = [UIColor clear collar]; (For UIView * subView elementView.subviews) {[subView removeFromSuperview]; } If (indexPath.section == 8) {imageView.image = [UIImage imageNamed: @ "yellow_Star.png"]; MyCustomButton * button1 = [[MyCustomButton alloc] initWithRating: 1]; [Button 1 setframe: CGRactack (15, 15, 25, 20)]; [Button 1 sethoschwhich has been highlighted: Yes]; [Button 1 addTarget: Self-action: @Selector (ButtonAction :) Control events: UIControlEventTouchUpInside]; [Button 1seviewview: image view]; [ElementView addSubview: Button 1]; [Button 1 release]; [See image release]; } Return cell; }  

and action in my buttons:

  - (zero) button action: (MyCustomButton *) sender {rating = [sender rating val]; Event.eventRatings = Rating; [Reload tableview data]; }  

and i MyCustomButton class: I have a method

  - (MyCustomButton *) initWithRating: (NSInteger) aRatingValue {if (auto = [super Init]) {self.ratingValue = aRatingValue; } Healthy return; }  

pls dis help help people.

Thank you, Manish.

You are trying to load the image named "yellow_Star.png" - check whether It is actually the name (in the case of the same letter). File system on iPhone is case sensitive and not on Mac OS - so it often causes such problems and the file name is the first thing.

Edit: You can also try to check if the image is present in the bundle or not - it may be removed from the scripts by copying resources Got it, this should be your image in a "copy bundled resource" build phase for your build goal. If this is absent then you can only drag and drop your image.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -