0

When I try to NSLog my image with this;

NSLog([images description]);

this appears:

2012-06-05 10:31:38.801 Project1[1180:1a303] (
    "<UIImage: 0x9a52bb0>",
    "<UIImage: 0x9c89460>",
    "<UIImage: 0x9c9c720>",
    "<UIImage: 0x8e4ee70>",
    "<UIImage: 0x8e805f0>"
)

I'm loading my UIImage from a NSDocumentDirectory.Could someone explain whats this.

Bazinga
  • 2,456
  • 33
  • 76
  • You can probably do `NSInteger meaninglessInteger = (NSInteger) [images description];`. – Hot Licks Jun 05 '12 at 02:50
  • Hi @HotLicks,What does this do? add integer to my array? Where should I put it? – Bazinga Jun 05 '12 at 02:54
  • More importantly, why in the world would you want to do that? What problem do you intend to solve by getting your integer? – Rob Jun 05 '12 at 02:56
  • Hi, You might want to see this: http://stackoverflow.com/questions/10767569/uitableview-index – Bazinga Jun 05 '12 at 02:57
  • What that does is "make this into NSInteger". Why in the world you'd want to do that I don't know, but it's what you asked for. – Hot Licks Jun 05 '12 at 02:58
  • assign an integer to it. – Bazinga Jun 05 '12 at 02:59
  • I hope you understand that we're all not trying to be difficult, but your question is _really_ confusing because it just doesn't make sense. Literally, it makes no sense at all. – Rob Jun 05 '12 at 03:11
  • Do I infer from your other post that you have a series of images that are presented in a view (thus they're either UIImageView's or UIButton's), and you're trying to determine which one the user tapped on? OMG, if that's what you meant by the question above, we never would have figured that out in a million years. If that is what you meant, though, let us know. – Rob Jun 05 '12 at 03:13
  • It's hard explaining in english though, cause I ain't fluent. And yes Im trying to determine which the user tapped on then passed its value to another ViewController, thus, make it the last price. – Bazinga Jun 05 '12 at 03:15
  • Ok, but the way you're asking the question, it makes us think that you've not done this before. It's analogous to saying "ok, I have car keys, how do I drive a car to Paris." You really need to develop some expertise (perhaps through on online course) about how to add controls to a view, how to get user response from that, how open a new view, how to pass data to that new view, etc. – Rob Jun 05 '12 at 03:25
  • Perhaps check out [this](http://itunes.apple.com/us/course/ipad-iphone-app-development/id495052415) or [this](http://itunes.apple.com/us/course/advanced-iphone-development/id497193807). Or check out what [Apple suggests](https://developer.apple.com/library/ios/#referencelibrary/GettingStarted/RoadMapiOS/Introduction/Introduction.html). Or just google "iPhone development training video". – Rob Jun 05 '12 at 03:33
  • If your command of iOS programming is stronger than your question suggests, you need to present us some evidence of such (e.g. sample screens from interface builder, your actual code, etc.). We'd love to help you, but we can't effectively teach you how to program iOS from scratch. – Rob Jun 05 '12 at 03:38
  • I know how to program but its kind of hard explaining what my problem is. – Bazinga Jun 05 '12 at 03:49
  • Then post your code and screen snapshots of your user interface (not drawings, but actual Interface Builder screens) and we'll try to help you. But your question implied that you didn't know how to add buttons to a view, nor how to respond to a user tapping on that button, nor how to pass this to another view controllers. If you can't do those simple tasks, it seems like there are some fundamentals of iOS programming that you have not mastered, and you should brush up on the basics before posting questions here. – Rob Jun 05 '12 at 03:57

1 Answers1

2

It looks like your images object is an NSArray (or similar array like object) of UIImages. When you NSLog the description of the images array it is listing the objects in the array and calling description on each of those objects. As it doesn't make sense to get a text description of an image it instead prints the object type, in this case 'UIImage', and the address of the object in memory, e.g. 0x9a52bb0.

I'm not sure what you mean by "And how to make this into NSInteger?' It doesn't make sense to convert an image into an integer.

mttrb
  • 8,297
  • 3
  • 35
  • 57
  • Add an integer to it. Like an index value. – Bazinga Jun 05 '12 at 02:49
  • You want to access the images in the array? You can do this using, for example, `UIImage *image = [images objectAtIndex:3]` to get the fourth image in the array. – mttrb Jun 05 '12 at 02:54
  • Ok, but why would you add an integer to the address contained to a pointer to a UIImage? You'll end up with a pointer to some random bit of memory. Yikes, that's a dangerous idea! – Rob Jun 05 '12 at 02:54
  • Because a want to compare my image in the array to another image in an array so I wanted to assign an integer to it. So it would be easy, I think, If its possible. – Bazinga Jun 05 '12 at 02:58
  • Is there a way to know or have them assign to a value? – Bazinga Jun 05 '12 at 03:05
  • 2
    @HotLicks: wasn't that a bit cruel? He wants to enumerate an array, is he really that backwards? – CodaFi Jun 05 '12 at 03:43
  • 1
    @CodaFi -- Not at all cruel -- good advice. He has too poor of an understanding of basic programming concepts and will be floundering with Objective-C. (Plus, working the way he is, he will never understand Objective-C correctly, but will just become "maze bright".) Better to start with something simpler, and develop a deeper understanding first. – Hot Licks Jun 05 '12 at 11:09