UISplitview - not from the appdelegate - iphone

I am trying to do an IPad app that needs to use UISPlitview. I have found a lot of examples of how to do this but they all come from the starting point of using the AppDelegate. Does anyone have a sample where it is used in the view pushed from a previous view?

In my searches for answers to basic splitviewcontroller questions I have come across your question. It is a little old now but I thought I would provide an answer for the next person that finds the question in the forum.
If I understand your question you have views and at some stage through user selection you would like to display a splitview on the window, is this correct?
You really have to understand the theory of a splitviewcontroller and also the wishes of Apple on that theory. When you understand this you will know that what you want to do is not really (or at least at the beginning of 3.2) what Apple would like. The Splitview should be the rootview of your app. Thus always there and not pushed or added later.
Now if you google long enough you will find examples where people have worked around this. Look at for example "Splitview in tabbarcontroller". But there are others.
As for a nice tutorial or example on this, I have not seen one but there are lots of forum questions and answers of workarounds of doing this.

Related

In-app tutorial

Im looking at adding a tutorial kind of thing to my app. Basically I want to be able to give a quick message across of what the parts in the app do. I want the users to see it once and not again. I have searched relentlessly for this but I always found app building tutorials.
A lot of games have what I want but I cannot for the life of me find how to do it or, what it is called to find a tutorial. Could someone please help me out.
Thanks in advance,
Sam
You'll need to build it yourself.
What I usually do is, on top of the view i want to explain, add a semi transparent view with some arrows pointing at stuff and a small text/button explaining it. All of that has to be modal and you can save in the NSUserDefaults if the user has already seen it/skipped it/launched the app for the first time. You'd have a method that builds all those views and you simply call it in viewDidLoad (by checking against a simple boolean value store in those previously mentioned NSUserDefaults, for example)

iPhone development - app design patterns

There are tons of resources concerning coding on the iPhone. Most of them concern "how do I do X", e.g. "setup a navigation controller", or "download text from a URL". All good and fine.
What I'm more interested in now are the questions that follow the simpler stuff - how to best structure your complex UI, or your app, or the common problems that arise. To illustrate: a book like "Beginning iPhone 3 Development" tells you how to set up a multi viewcontroller app with an top 'switcher' viewcontroller that switches between views owned by other view controllers. Fine, but you're only told how to do that, and nothing about the problems that can follow: for example, if I use their paradigm to switch to a UINavigationViewController, the Navigation bar ends up too low on the screen, because UINavigationViewController expects to be the topmost UIViewController (apparently). Also, delegate methods (e.g. relating to orientation changes) go to the top switcher view controller, not the actual controller responsible for the current view. I have fixes for these things but they feel like hacks which makes me unhappy and makes me feel like I'm missing something.
One productive thing might be to look at some open source iPhone projects (see this question). But aside from that?
Update
To clarify: I suppose what I'm asking about could be summarised as "Recipes and Gotchas for iPhone development". The sort of things that are of interest to developers, but aren't covered in any of the iPhone books etc. that I've seen, such as:
I'm writing an iPad app and want a UISplitViewController presented to the user only some of the time, which Apple seem to be saying I can't do. Is it possible? How?
Apple don't give me a way to stylise my app in a convenient, across the board way (e.g. font tweaks, or colours). How can I approach styling my app?
Memory management isn't made any easier by some of the inconsistencies in UIViewController method names (e.g. viewDidUnload is not the opposite of viewDidLoad, despite the name). Is there a consistent easy way to tidy that up and make view controller memory management less error prone?
How can I consistently and easily test my view controllers for behaving correctly when a memory warning comes in? It's easy to simulate a memory warning in the Simulator, but if the UI I want to test is showing (and is a 'leaf level' view controller), it won't get its view unloaded because it is currently visible.
N.B. I'm not actually asking the above questions here -- I think I have decent answers to them! -- just giving examples of 'good' questions that illustrate this stackoverflow question.
The WWDC talks available on iTunes U (at http://developer.apple.com/videos/wwdc/2010/) have some great information about structuring, especially in the Application Frameworks section.
If you're talking about code, use the Model/View/Controller pattern like in most Web applications:
The model code defines the objects that your program represents. A time tracker app, for example, might have model objects like Task, TimeSlice, and User (especially in a network setting).
The view code is provided for "free" with the iOS SDK, unless you need specialised view code. These are UIImageView, UIButton, etc.
The controller code bridges the 'gap' between the model and view. The controller will change the views to reflect the model selected by the user and facilitate the selection of model objects.
This is the base design pattern for any iPhone app, and it's the one that most will use.
If, on the other hand, you refer to what we in my company call UX (user experience) design, however, you can't beat the Apple HIG guidelines in the Apple iOS SDK documentation set, available online or in Xcode from the Help menu.
The other thing I recommend quite highly is to play around with some test/dummy code. Nothing can top experience. Experimenting with the iOS SDK and getting your hands dirty will allow you to truly learn the best ways to design apps.
Edit:
Also, delegate methods (e.g. relating to orientation changes) go to the top switcher view controller, not the actual controller responsible for the current view.
Can you clarify? In all of the apps I've written, the currently shown view controller receives the orientation change methods. Note that there are two methods. shouldAutorotateToInterfaceOrientation: allows you to decide if the view should rotate, and didRotateFromInterfaceOrientation: allows you to re-layout the view if necessary.
Please go through this link. In this they have explained clearly about design patterns.
http://www.raywenderlich.com/46988/ios-design-patterns
You might want to consider watching videos like the CS193p course from Stanford on iTunes U. They go through the most important parts of iOS development in deep, and give some source code.
As far as I can tell, there isn't a book or resource which deals with the sort of advanced gotchas and recipes that I was looking for. Loads of useful resources exist, but just not addressing the stuff I'm thinking about.

Architecting iPhone Views - seeking help on a specific issue + general advice

I am primarily a web developer (ruby, python) that is new to iPhone development. I've done some desktop development in the past within the MS environment (C#), but never anything on the mac.
I'm trying to build a really simple iPhone application and I am confused by the way that views work in general. If someone can provide advice for my particular problem, along with some resources where I can learn how to architect iPhone views in the future, that would be awesome. I feel like a lot of the Apple documentation that I've come across is too specific - I am lacking a fundamental understanding of how views work on the iPhone.
My particular problem looks like this:
I need one view that displays some downloaded text content. This is the view that shows when the app loads, and it is pretty straightforward.
Then I need a settings area (I've already decided I don't want to use the iPhone settings area). The settings area main page will have some text fields on it. It will also have a 2-row grouped table. Each cell in that table will take you to another view which also has a grouped table used for multi-select. I suspect that I can reuse the same view for these two final "detailed setting" views.
In summary:
home page
settings main page
detailed setting 1
detailed setting 2
Any help and advice appreciated.
It sounds like you already have a good idea of what you want each of your screens to look like; that's a good place to start.
What you're probably going to want to do is use Interface Builder to lay out the objects in each view (textfields, buttons, etc.), and then have a custom View Controller (subclass of UIViewController) for each view. You would then navigate to a new view by doing something like:
MySettingsController *controller = [[MySettingsController alloc]
initWithNibName:#"SettingsView" bundle:nil];
[[self navigationController] pushViewController:controller animated:YES];
(assuming a navigation-based app).
If you haven't yet, I recommend reading Apple's View Controller Programming Guide
Some advice: Despite your back ground, don't think of the views as pages or the app as a web site. That will cause you problem in your design because the technology is different and views don't work like web pages and apps don't work like web sites.
The major difference is that while web pages often contain actual data, views do not. The view object is only concerned with display. It doesn't know what it is displaying and it doesn't store or logically manipulate the data. The data comes into the view from the view controller which itself gets it from the data model.
See Cocoa Core Competencies: Modal View Controller
Rails uses MVC if you've used that with Ruby. The basic principles are the same.
Well, there are plenty of information on Apple developers' pages: you could start reading Your first iPhone application
There are quite a few good sites with very good info both on cocoa and iPhone developing:
Cocoa with love
iCode blog
and many more (google is your friend in this).
A couple of books I liked are "Beginning iPhone3 Development" and "iPhone developer cookbook".
The first is probably more useful at the beginning (no pun intended)
As for the specific case of yuor application, you could use a navigation controller for the settings page, and each time you need to dive into the details you will just push the right view onto the navigation controller's view stack.
So you would design 4 views with the interface builder
Main view
Settings view
Detail 1
Detail 2
And then push the views onto the navigation controller.
It's pretty straightforward, I won't go into the details, but just searching something like "iphone navigation controller example" on google will give you plenty of samples that you can easily adapt to your needs.
These were all helpful responses, in particular the reference to the iPhone View Programming Guide. This helped me to diagnose my misunderstanding which was related to the role of View Controllers, and the relationship between individual views and view controllers. I think part of my confusion came from learning MVC in the context of Rails, where this relationship is quite different.
For others looking for advice in this general area, I would recommend checking out Lecture 6 from Stanford's iTunes U iPhone Application Development course from Winter 2010 "Designing iPhone Applications, Model-View-Controller, View Controllers", and the lectures 5 & 7 if you have time. I think that was when the penny dropped for me, despite having already looked at a few of the books mentioned here.

iphone application layout

I'm trying to get started with an iPhone application, I had a look around at other questions but i'm still sorta stuck so hopefully someone can help...
First thing is I'm totally confused with the whole view concept, I'm more used to visual studio so I'm going to use the term 'form' to describe what I have in my head.
I want to achieve a home screen in an application with say 9 icons (much like the iphone home screen) which each lead to a different 'form'. Each form may have a different function so say one might be a simple calculator, one might play a video etc.
How do I do this, its destroying my soul trying to do something so simple... If you guys even have any links to get me on the right track it would be greatly appreciated
I suggest you take a look at the Stanford iPhone Programming Course. If you don't have the time to look through it all, I reccommend at least Lectures 5 and 6 about Views and ViewControllers. The slides are quite instructive and they come with video presentations that should help you get on your way in about an hour.
Apple's samples are a great place to start. There are some simple ones that can show you how views and view controllers work.
Also, in Xcode, when you create a new iPhone app template, that template usually has enough code to display a view, and sometimes a flip-side view or more. Sometimes, you should stop reading, and do.
I had the same weird learning curve as you, as things don't initially seem to make sense but they do - and once you've got your head round them they make perfect sense trust me!
Your 'forms' are viewControllers in this M-V-C land, they control all the 'view' (which are controls or any object which can be seen) within them. Normally they are loaded from a Nib (design from the interface builder), but don't have to be.
The way I would go about your problem is to use a navigationController as the base to handle all of your view controllers.
A navigation controller needs a rootviewcontroller to start so this will be your desktop Viewcontroller. I'm not sure how you are planning to populate this but all the icons will need to be stored in some kind of array. I suggest you use a simple UIButton. When then button is pressed you then alloc and init and push the required view controller.

How to create this customized UI?

i m new to iphone development
i want to create a view like this..
1.home screen contains
a. a navigation bar
b.a uiimageview
c.a toolbar(with 4 buttons)
2.new view contains
a.navigation bar with back button which leads to home screen.
b.a UITableView.
3.another table view
with navigation bar leads back to (2nd view)
note i want to load new view with the tool bar button.
That's excellent. Thanks for the update! Keep us informed on how you're doing with that.
Actually, it would be a disservice to you for us to write your code for you. Why don't you try looking at Apple's sample code on the iPhone Dev Center? It'll answer your question.
You can come back here and post code that you've tried that isn't working.
Probably not the answer you want, but I'm pretty sure you'll benefit more from actually researching the question and trying it out on your own.
Following up on Jordan's answer, the place you want to start is Getting Started w/ iPhone OS. For the type of code you're talking about, you should then investigate the View Controller Programming Guide. When you've gone through the samples and start having trouble with your own code, the Cocoa/iPhone crowd here at Stack Overflow is incredibly helpful. But a statement of program requirements isn't an SO question.