Hi Guys,
I think I am thinking about this all wrong..
Okay, so I have started my small project. First real project without a tutorial at hand and pretty excited by this - however, I am stuck at the "data" part of my app idea.
The idea of this simple app is to list all Apple devices in a table view. That's the easy part, I guess.
So my first though was - no problem, just stick them in an array with NSString objects. But this is not what I want.
This is what I want:
Each Apple device to be an object that contains:
Device name,
Device model,
Device image
Device release year
etc
Then put that object into the array and the do what I like with it.
So what I was going to do is this:
1. Create a new class for the devices (iDevice.h)
2. Add properties to that class of the above attributes
Create a new object like so:
However I don't think this is the correct way and if I want to allow the user to add their own iDevice it would require more work than normal, I think.
I also tried NSDictionary - but that got real messy, quick!
I think I am looking to make the iDevice object.. reusable and not create so many objects that do the same thing..
This app will never make it to the store - it's more to help me understand iOS development better - I just need a push in the right direction here.
Any advice or help would be much appreciated
I think I am thinking about this all wrong..
Okay, so I have started my small project. First real project without a tutorial at hand and pretty excited by this - however, I am stuck at the "data" part of my app idea.
The idea of this simple app is to list all Apple devices in a table view. That's the easy part, I guess.
So my first though was - no problem, just stick them in an array with NSString objects. But this is not what I want.
This is what I want:
Each Apple device to be an object that contains:
Device name,
Device model,
Device image
Device release year
etc
Then put that object into the array and the do what I like with it.
So what I was going to do is this:
1. Create a new class for the devices (iDevice.h)
2. Add properties to that class of the above attributes
Create a new object like so:
Code:
iDevice *device = [[iDevice alloc[init]
device.deviceName = @"iPhone"
device.deviceModel = @"4S"
[deviceArray addObject: device];
iDevice *device2 = [[iDevice alloc[init]
device.deviceName = @"iPhone"
device.deviceModel = @"5"
[deviceArray addObject: device2];
However I don't think this is the correct way and if I want to allow the user to add their own iDevice it would require more work than normal, I think.
I also tried NSDictionary - but that got real messy, quick!
I think I am looking to make the iDevice object.. reusable and not create so many objects that do the same thing..
This app will never make it to the store - it's more to help me understand iOS development better - I just need a push in the right direction here.
Any advice or help would be much appreciated