Best place to define a var for sharing between distinct UIViewControllers?

My app has two distinct UIViewController subclasses that handle two distinct UIViews. Both of these controllers need access to the same array of data. Where is the best place to define this array? In the AppDelegate class? If I define it there, how do the ViewControllers gain access to it?

"...rather than assuming you have a pointer to the label in your init method, it might be something you need to fill in in viewDidLoad. That's a great place to do that sort of thing."
I found out the hard way that it's not a good idea to try and do anything with the view in initWithNibName. It's ok to initialize controller data structures there, but setting up the view objects should be done in viewDidLoad.
I started trying to learn iPhone programming from scratch last summer. I'd been a C/Win32 developer since before it was 32 and hadn't programmed a Mac for over 15 years (they've changed a little since then). I thought Cocoa was hot chocolate. Amazon had lots of great looking iPhone SDK books for me to order, but none of them was published yet. When I downloaded "HelloWorld" I spent several hours trying to find where that string came from.. Should've know it was a resource, but I was too disoriented to include *.xib in my grep. Most of the docs at the iPhone Dev Center were pretty scary, and there wasn't much comfort from the Introductions that promised "The iPhone API is very similar to OS/X except..."
When I found out about CS193P I phoned Stanford right away. The $3000 price gave me pause, though. I could audit for less, but was told auditors couldn't ask questions. I wasn't about to ask my employer to help me retool for the iPhone, so I passed on the course. In hindsight I might have had some buyer's remorse when the course was offered for free this Spring. But I sure wish I'd had those lectures last Summer!
Seems to me there needs to be a 'best practices document regarding memory management. I believe there's something like this in the docs, but I need to look into it.
That would be +Memory Management Programming Guide for Cocoa+. If you don't read anything else in that guide, read and memorize Object Ownership Policy.
If you continue to help me out, I'll be sure to mark everything 'answered' so maybe you can take the top slot among contributors!
I'm smiling now. The point system here is fun, and the yellow and green stars are fun to find in the morning. But I'll have the thank you notes long after the points are erased (probably due to Apple Discussions' plan to kick the dev forums out--see the Feedback forum for more on that sentiment).
Actually it's strictly against the rules to discuss points when providing help unless asked, and the people who need help the most usually have no clue about points anyway. At least half the time, you'll see a message saying "Great! That solved the problem", and the OP has closed the thread by clicking "Mark question as answered" (no points) at the top of the page instead of "Solved" in the helper's reply.
What I'd really like is for our nos. 1, 2 and 3 to come back to this forum!! I'm hopeful Rick will return, but worried about 1 and 3 due to the circumstances of their departure. Both Etresoft and Orangekay are experts. They were here almost every day and could handle the advanced questions. I could rely on them to correct my mistakes. If you do a little detective work up in the Feedback forum, you'll see what happened to Etresoft.. Certainly an imaginative way to repay years of expert volunteer service. I shouldn't get started on that, though.
Come to think of it, you actually didn't ask for my life story. But I have a reputation for being verbose that sometimes requires going the extra mile.
\- Ray

Similar Messages

  • Best Way to Define Employee Numbering For Different Countries

    HI all
    I am working on for a project which will be for Multiple countries.But Each country has different Instances.Now the questions is What could be the Best way to Define Employee numbering for all the Regions ? As for as My knowledge goes It would be Number prefixed by Country.Then How we can have Alpha numeric in employee Coding ? We need to have Fast Formula to Ahieve this task.If any body has come across this scenario please share your thoughts .Any thoughts are greatly Appreciated.
    Cheers
    Kumar cs

    If you have each country on a different instance and you want employees to retain their employee number on transfer between countries, I believe you have two options:
    i) Use manual numbering. One recent change to the system is that you can update the numbering profile from Auto to Manual and back to Auto again. So you could potentially leverage this manual workaround when a cross BG transfer happens.
    ii) Bespoke module to export all emp numbers into a 'central repository', e.g., flat file, that can be accessed by all instances, imported regularly and then referenced by your Fast Formula. You would also need processing to determine when a person is a transfer from another BG or a new hire; probably have to be some control field on flex. Basically, this is a requirement made difficult by the decision to host each legislation on a different instance; I would never recommend clients to go down this route but I guess it's too late in your case.
    If cross BG transfers are not common, e.g., less than 5 a week, I would recommend option 1.

  • Best Place in Folder Hirearchy to Store Shared Referenced Aperture Picture Folder?

    Hi,
    I'd like to use Aperture in "referenced" mode for my photos (I'm user1).  I'd also like the other user of my mac (user2) to be able to use this folder to see photos. What would be the best place in the OSX folder hierarchy to create this share?
    should it simply be in /users/user1/sharedPhotos or should it be somewhere above the "users" directory?
    Thank you.

    This is a two part answer:
    1)  The /Users/Shared folder is intended for this purpose.  E.g. you could create a folder under /Users/Shared/Pictures/ as an example location.
    After creating the folder, select it, right click and do a "Get Info".  Check that in the "Sharing & Permissions" section of the info window that you add the other user as having the ability to "read & write" (or change the permission on "everyone" to "read & write")
    HOWEVER... this may not have the results you were expecting.
    When using "referenced" masters, the only thing in that folder will be the "master" images... these are sort of like digital negatives.  Aperture never actually changes a "master" image.
    That means that if you start making adjustments, the other user will NOT be able to see those adjustments because all of Aperture's data is really stored inside the Aperture library.   Your project & folder hierarchy, your list of slideshows, light tables, books, etc; every adjustment you've made to an image; image rankings, keyword tagging, etc. etc.  all of that would be in your Aperture library and not visible to the other user (and likewise none of their changes would be visible to you.)
    I do not think this is what you want.
    2)  SO INSTEAD, use "managed" masters (when you do an import, select the option to "Store Files:  Inside the Aperture Library") and then move the entire Aperture Library to the /Users/Shared/Pictures folder and make sure both users have "read & write" access.
    The only catch is that if you use "Fast Users Switching" on the Mac, make sure you quit Aperture before switching to the other user account and starting Aperture (do not allow both user accounts to keep Aperture running at the same time.)

  • Best way to create a playlist for sharing? having some issues

    So my friends and I like to exchange playlists. So I'm trying to create a compilation that when my friend drags the folder of music into his iTunes the order of songs is how I want it. I want it to import into their iTunes like a regular compilation album.
    Issues this time around:
    - I can't for the life of me make it so the order of the compilation imports in the right order
    - One of the songs REFUSES to change info. I change the name of the album to the comp title and select "part of a compilation" it changes but then as soon I play it it changes back to it's original album title and is no longer part of my compilation
    What I've done:
    - Picked the tracks I wanted and dragged them into a folder on my desktop
    - imported them into a playlist in a different iTunes library
    - Selected all, command+I, changed the album to the compilation name, marked it as a compilation, marked it as Disc #1 of 1
    - Selected each track separately and marked the Track #1 of 15, 2 of 15 and so on
    is there something I should be doing differently for better results?

    Thanks, Jason...mostly just for neat and clean.
    But, John also said we'd have to create an ADS Group to put them in, and use queries to bring those that need into the collection for installation, then remove them when the product shows in ARP.  Which is about the same as adding them into the collection
    and then never removing (we'd have a group with computers in it).
    I had thought there was some way to automatically remove things from manual collections, but...guess not.

  • Best place to look on Pacer for status

    I'm 65 days out from my 341 now and am wondering if I should keep checking docket report or status. Thanks!

    Use the RSS feed and do control f (find) if on a computer and look for you name. The RSS feed looks like a speaker next to the court link for your district. This won't count against your page count for Pacer. You can refresh often with that page.

  • One of the Best places to Find Extended help for you Droid Maxx

    I Went to the Motorola's Help page and found whale full of stuff for all kinds of Issues and just plain help on learning the ins & outs on my Droid Maxx  b33
    http://goo.gl/3mmC7O
    Duplicate content - please see:
    https://community.verizonwireless.com/message/1052367#1052367
    Message was edited by: Admin Moderator

    Interesting post, I enjoyed it.
    However, keep in mind, Arch is not Fedora. It is not Red-Hat-esque, not newbie-friendly, nor will it ever aim to be so.
    http://wiki.archlinux.org/index.php/The_Arch_Way
    The way Arch does things is different in that it strives to use the most elegant and simple methodology. Note that simple does not mean "user-friendly", it means just that, simple. System configuration is left entirely up to the user. There are no GUI configuration tools; system resource controls are handled through configuration files and from the command line. This is unlikely to change.
    What you may see as unfinished or raw, is actually the way Arch devs and users prefer the system to be, so your assumption that Arch has not reached version 1.0 is not quite accurate in this sense.
    "It is what you make it." In other words, you build it, but it won't hold your hand along the way.
    Take advantage of the excellent documentation in the wiki (especially the beginner's guide) and the community. When you adopt the Arch way of doing things, I am sure your C+ rating will go up, as you will have gained the knowledge of how truly elegant and powerful Arch can be.
    Welcome to Arch!

  • Where to place java code in webdynpro for communicating between views

    Hi Friends,
    Where should I put the Java code on click of button for the action.
    I can out in init() method, or in teh onActon methods.
    I think suppose I have two views view1 and view2
    on click of one button on view1, user shoudl see results on another view.
    for that I think best is to put data accesing logic for view2--in onAction of view1 itself.

    I've been looking at my examples,  you can do it either way.  In one example, I have coded the logic in the Inbound Plug method on the Result view.  In another example, I am doing the logic in the onAction method when the user presses the button on the Start view.
    I'm thinking it may be better to do it in the onAction method, but it really depends on the overall functionality of the application.
    Regards,
    Rich Heilman

  • Folder permissions for sharing between users on the same machine

    Hello,
    I have several accounts on my MacBook and I want to keep some files private and some files shared with full permissions for everyone.
    OS X standard behavior for the default Users/Shared folder is that everyone has read/write access to the folder, but if you create a new file there, then only the creating user has write access to that file.
    I want to change that folder's behavior so that newly created files can be modified by everyone on default.
    How would I do that?
    Thanks.

    Thanks, your answer helped me a lot. I found an even simpler method which doesn't require any extra applications.
    Open console and navigate to the directory where your share directory is located, e.g. /Users/Share/
    create the desired folder:  mkdir public
    set acl permissions for each user with: chmod +a "username1 allow flag1,flag2, ....." public/
    check permissions with: ls -le
    Example:
    chmod +a "dev allow list, add_file, search, delete, add_subdirectory, delete_child, readattr, writeattr, readextattr, writeextattr, readsecurity, writesecurity, chown, file_inherit, directory_inherit" public/
    This will give the user dev full access to that folder. Any file or directory created inside that folder by the user dev will also inherit the permissions of that folder.
    Also, the advanced permissions override any other permissions. you can test that my making that folder inaccessible with chmod oga-rwx public/ and dev will still be able to access it because of the acl permissions.
    exactly how i wanted it.

  • Can I setup a folder on the time capsule for sharing between computers not on my network?

    I'm wanting to be able to share files between family members that don't live in the same household. How would I set up a single folder on my Time Capsule so everyone can use it as a shared network drive between Windows and Mac systems, with security?

    No.  Your Mac will mirror the folders on icloud.com.

  • IDML format for sharing between CS5 and CS6

    My colleague uses CS6 and I use CS5 so when working on a document together he is able to save in an IDML format. However when either of us then subsequently open this document it opens as Untitled and we then have to re-save the document. This leads to lots of versions of the same document which isnt very useful - is there any way that we can avoid this?
    Thanks

    No - it's treated as a brand new file, hence the Untitled.
    You need to save it to continue.
    Ideally - both of you should be using the same version of InDesign to avoid any compatibility problems.

  • Best place for spare parts for PPC 1.5 Mini?

    Hi.
    I'm looking for the best place to get spare parts for a Mac Mini PPC G4 1.5GHz on the net. The fan is most likely giving up, because it has recently begun to sound as the bearings in the fan are bad.
    Regards,
    /Mysteron

    Hi Mysteron-
    I've used these folks for other projects: MAC-PRO
    If you don't see what you need or have questions try giving them a call as they are very helpful.
    Luck-
    -DP

  • Spinning Beach Ball Delay with "Look for Shared Photos" Checked

    We installed iLife '06 on our school computers - all 500 of them - this fall. It is version 6.0.4. However, upon launch, there is a long delay of about 2-4 minutes with a spinning beach ball that we've determined takes place because iphoto is looking for shared libraries. We have one shared library on the network at this time, but sometimes teachers turn on sharing, or have in the past.
    Last year, we were using iPhoto '04 and had no problems like this at all -shared libraries appeared immediately, just as quickly as shared libraries in itunes still do.
    Has anyone experienced this - is there a known issue? Or should I look for a network problem.

    Solved this problem myself. It was a dns issue. For some reason, when iphoto looks for shared photo's, it does a reverse lookup on the ip of any machine it finds that has sharing turned on. If there is no reverse lookup zone on your dns server running OS X then it locks up as it repeatedly sends the request. Simply creating a reverse zone for the ip address range of your clients makes the bug go away. Why it needs to do a reverse lookup is beyond me.

  • Best place for CUA

    We've got ECC, BW, XI, EP, SolutionManager installed and want to implement CUA.
    I want to know your comment on:
    One CUA or more CUAs, we have 3 systems (DEV, QAS, PRD) landscape for each system.
    *Where is the best place for CUA?
    TIA.

    Hi Team FI,
    There are other factors that may be considered when deciding where to put CUA.  For example:
    Are you using Indirect Assignment of roles also?  If so, then simplicity would say, put the CUA on the same system as the HR module (saves having to ALE over the PD object -> Role relationships to different CUA system).
    High availability - normally your ECC system would have the highest availability due to the critical nature and impact on business, so it would make sense to put it on your ECC system if this is the leading factor.
    What is your role integration strategy like?  I know some clients that have excellent integration across all systems such that a 'role' is defined as all of the access that you require inclusive of all SAP systems, and LDAPs.  If this is the case, then you can have a single CUA system.  Assign ONE composite role to the user, which then provisions out single roles to all of the other SAP systems (including non-prod) and synchronises with your LDAP.  If your role integration is not as 'good' as this, then you may consider having two CUA systems.  One for the prod systems, and the other for the non-prod systems.

  • Where is the best place to buy a replacement screen for late 2007 Macbook (3.1)?

    All,
    My screen needs to be replaced on my late 2007 Macbook.  I am willing to do the work myself, but need help in finding the correct model screen to buy.  Where would be the best place to buy?

    Depending on your geographical location, region, country, etc, part
    sources will vary. So this is an open question. An independent
    authorized Apple trained repair specialist or service facilitiy may
    be able to get the part(s) and do the service. That is an old MB
    and a regular Apple Store may be able to diagnose or estimate
    a repair cost; but it also could be too old for that route to repair.
    A best place to buy a part could be anywhere one is for sale;
    there are several online and some ship almost world-wide.
    If you are in north America, there are some who also may ship
    to other areas, but then there is shipping, taxes, duty fees, etc.
    You may be able to narrow down the part numbers and such
    by looking into online parts resellers, an example may be
    powerbookmedic.com, powermax.com, wegenermedia, etc.
    There may be a part number reference in iFixit.com guides.
    A service part such as main original hardware is more difficult
    than a replacement hard disk drive or optical drive. Availability
    varies, so without knowing where you are, I can't speculate as
    to that, or any price structure. Authorized repair centers may
    be found in the main online Apple links for service centers.
    Sorry to not be of much help

  • Best Practices for sharing media with iMovie and FCPX

    So I've a large iMovie Events directory, and would like to use that media with both iMovie and FCPX projects.
    I'd rather not duplicate the media, so would prefer to import as references into FCPX.
    The dilemma is that I see that it's possible to modify or move media from within the iMovie application, and therefore break the reference to that media with FCPX.
    I only see two options:  (1) Never Ever modify the location/name of media in the iMovie Events file (even from within the iMovie app) since I would break an FCPX link if that media is referenced, or (2) always import (copy) the iMovie events into the FCPX Event Library making an independent original so that I can confidently operate on those media files in either application.
    I'd surely rather not have to do (2 )(e.g. doubling my storage demands) to gain the flexibility of using either application to edit the video, but really don't want to live with the restrictions of (1).
    Thoughts / Solutions?  What might you consider as options or best practices?

    Unless there is some other reason, users should own the right to share their mailboxes - it shouldn't be something that demands administrator management (if only so that the administrators aren't swamped by user requests for sharing their mailboxes). 
    For true shared mailboxes, when the mailbox is created, full access is granted by an administrator.

Maybe you are looking for

  • Report  Query - PO dates-urgent!!

    Hi Experts, I want to know if there is any quicker way to get the validity dates from all the Open Purchase documents (Purchase Scheduling Agreements) Our requirement is: We want to populate all the validity dates for the following. 1) First we need

  • Error message "posting date is initial"

    I m getting error while adding material to pre-existing contract - "posting date is initial" (Message no. F5669). looks like Fiscal year and period cannot be derived. Please help. what could be the reason for this message SK

  • Roles in Authorization Editor

    Hi, In JDev10.1.3, we can copy a system-jazn-data.xml to JDEV_HOME/j2ee/home/config, so the roles in the file can be listed in Authorization Editor when select edit Authorization on a jsf page. But in JDev11, I did the same, but the roles listed in t

  • Regarding delete entreis from infotype

    hi experts, i need to delete multiple records from the custmized infotype one at a time plz suggest me how to do that plz dnt suggest loop at itab,hr_infotype_opertaion as i already used but it is taking so much of time for deleting 4000 to 5000 entr

  • Elements 10 to new computer

    How do I do this? Your website sends me in endless cirkles...