Understanding some fundamental GUI app tasks

Discussion in 'iOS Programming' started by arnekolja, Jan 17, 2009.

  1. arnekolja macrumors newbie

    Jan 17, 2009
    Hi there,

    I have some very fundamental questions in GUI programming, especially iPhone programming of course, that I don't see covered in any books I read so far, so maybe I get some help here :)

    Well, I am hardly new to coding so far, have some overall experience in object oriented coding, but never wrote GUI apps that went further than one window. And there's my big problem: understanding having several windows (forms, frames, dialogs, whatever). And, secondly, having some sort of app-wide data to handle with it.

    Let's assume I want to write an app that has got a default window with several buttons that lead to new dialogs. All of these dialogs give the user the ability to edit parts of the app-wide data. The data may be a record set read from a data file for example.

    Problem 1: How do I handle a GUI app that bases on not only one window and an about dialog in the most efficient and common way? Why I am asking this is because every single book I read and that handled GUI things did not clearly articulate the options I have on this, but just used some quick and dirty code examples without further explanation. Well, maybe here it's rather my fault, thinking that windows should handled "in a special way" but are only objects like any other, but is it just that simple like creating any object? Do I just instantiate a new object of my pane's class and destroy it when going back? _Will_ I destroy the newly created dialog object or would I rather keep it open for further use? What's the most common and most useful way to handle such things?

    Problem 2: Handling app-wide data. I often read about it and already used the singleton pattern, for example. But is the singleton always the way I'd take to handle my app-wide data? Are there other, more common ways to do so? I am asking this especially because Obj-C differs from many other languages as it doesn't make much use of privacy modificators or such. So assuming that the typical Obj-C programmer doesn't that often use the singleton, how would he get along with passing thru some data he wants to be used in his whole app? Thinking of object orientation it wouldn't make much sense to pass it via init functions, would it?

    Well, I think I could not really clear out what's my big problem here, but maybe there's someone who understands. And maybe with some discussion I get into my problems much clearer than I do at the moment, so of course, any help is welcome :) If not here, then maybe via instant messaging anyone? I'd really love to understand the most common ways to achieve basic day-to-day tasks in GUI development and think that's a part that doesn't get covered in books too well right now, that's all :)



Share This Page