Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone ($4.99)

dotnetIQ ($4.99)

Your First iPhone App ($1.99)

iPocket Tools 9 in 1 ($0.99)

Catch-Me (Free)

Alien Strike ($0.99)

Historic Olympic Medal-Table ($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 01-07-2009, 04:37 PM   #1 (permalink)
New Member
 
Join Date: Jan 2009
Location: San Jose, CA
Posts: 14
Default Newbie: Architecture Question

I'm still coming up to speed on this iPhone development stuff. I've written a lot of code for Palm and WindowsCE devices so thought this would be easy, but I'm having a hard time getting my head around some these iPhone SDKs. It's getting there but slower than I expected.

So I want to display four columns of cards. My initial thought was to have a single view and draw everything in the view myself. But the more I learn about Views I'm wondering if it might be better to have each column as a subView of the main View instead. I could even go a step further and make each card be a subView inside each column View.

So my question is...is this a reasonable approach, or are their pitfalls to doing it this way?

Thanks.
Moose408 is offline   Reply With Quote
Old 01-07-2009, 04:42 PM   #2 (permalink)
New Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,121
Default

Personally I think it's reasonable to have each part be its own view class. Makes for better modularity. Each class is specialized to do one thing. Good OO design. Of course it's more classes to manage but I think the benefits far outweigh the minor downsides.
RickMaddy is offline   Reply With Quote
Old 01-07-2009, 05:23 PM   #3 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 1,431
Default

If this is something like a solitaire game then making each card its own view will simplify things for you.

I wrote a sliding tile puzzle game as my first app. It has a 5 x 5 grid of tiles. I made each tile its own view and it worked out well. If you don't make each card its own view then you'll be duplicating some of the functionality of UIView for each card. Things l like hit testing and animations to move the cards are simple if they're individual views and complicated if you have to write them yourself.

The only issue I would think might come up is drawing performance. More than 20 or 30 views might take longer to draw or animate. However, you're probably only going to be manipulating one or a few views at a time so it shouldn't be a problem.

There's a class called CALayer that is reported to give faster drawing performance than a plain view but for your first app I'd recommend staying with UIView.
PhoneyDeveloper is offline   Reply With Quote
Old 01-07-2009, 06:42 PM   #4 (permalink)
New Member
 
Join Date: Jan 2009
Location: San Jose, CA
Posts: 14
Default

Thanks for the input. The cards are static once placed in a column so it perhaps doesn't make sense to make each card be a view. But I will take the approach of making each column a view.

Thanks again for the help.
Moose408 is offline   Reply With Quote
Reply

Bookmarks

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
» Stats
Members: 21,490
Threads: 35,768
Posts: 156,681
Top Poster: smasher (2,448)
Welcome to our newest member, pongteam2
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:04 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0