Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-06-2011, 09:20 PM   #1 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 42
xcoderx is on a distinguished road
Default Added table view cells with different images

I have a table view and i want to have a different image on each cell depending what button was pressed. I Want the app to be like the amazon application on ipad/iPhone. I want the image of the product to be in the cell, depending on what button was pressed. The buttons are on a seperate page also. The code i have so far is this:
Code:
 
- (IBAction)outlet1:(id)sender {

    [cart.cells addObject:@"1"];

   cart.cell.imageView.image = [UIImage imageNamed:@"paddle1.png"];

}
- (IBAction)outlet2:(id)sender {

     //Cart is just referring to a different flie. (im not sure how to use the correct terminology.)
    [cart.cells addObject:@"1"];

    cart.cell.imageView.image = [UIImage imageNamed:@"paddle2.png"];

}
This button adds the cell correctly, but doesnt add the image. I also call:

[myTableView reloadData];
in the viewDidLoad method.
Please help! ive been stuck on this for about a week and no one will seem to help! Thanks in advance!!
xcoderx is offline   Reply With Quote
Old 10-06-2011, 09:53 PM   #2 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

1. Don't change cells like that. Only modify cells in the cellForRowAtIndexPath.

2. Don't access another view controller's view.

Have 2 arrays, one for text, and one for images. Add the image to the array and let the view controller which controls the table view reload the tableview.

Edit: Aww man... I missed my 1337 post count.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 10-08-2011, 01:46 PM   #3 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 42
xcoderx is on a distinguished road
Default

Quote:
Originally Posted by Domele View Post
1. Don't change cells like that. Only modify cells in the cellForRowAtIndexPath.

2. Don't access another view controller's view.

Have 2 arrays, one for text, and one for images. Add the image to the array and let the view controller which controls the table view reload the tableview.

Edit: Aww man... I missed my 1337 post count.
Works perfect!! Thanks so much!!
xcoderx is offline   Reply With Quote
Old 10-08-2011, 03:51 PM   #4 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by Domele View Post
--snip--
Edit: Aww man... I missed my 1337 post count.
..but only an uber-nerd would care about such a thing (or know what it was without looking it up) So I guess we're both in trouble. <sheepish grin>
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 10-09-2011, 09:43 PM   #5 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 42
xcoderx is on a distinguished road
Default

Quote:
Originally Posted by Duncan C View Post
..but only an uber-nerd would care about such a thing (or know what it was without looking it up) So I guess we're both in trouble. <sheepish grin>
WTF?? ur hella weird bro!! U are the only one thats in trouble with that weird *** mind of urs, "Sheepish grin" ??
xcoderx is offline   Reply With Quote
Old 10-09-2011, 10:08 PM   #6 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

Quote:
Originally Posted by xcoderx View Post
WTF?? ur hella weird bro!! U are the only one thats in trouble with that weird *** mind of urs, "Sheepish grin" ??
What's that supposed to mean?
baja_yu is offline   Reply With Quote
Reply

Bookmarks

Tags
table view, uiimage, uitable view

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 400
18 members and 382 guests
13dario13, 7twenty7, eski, EvilElf, glenn_sayers, HemiMG, iOS.Lover, jarv, LunarMoon, n00b, pbart, Pudding, QuantumDoja, sacha1996, Sami Gh, UMAD, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,672
Threads: 94,122
Posts: 402,906
Top Poster: BrianSlick (7,990)
Welcome to our newest member, yuncarl28
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:21 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0