If I create a IOS framework that will be shared between projects, can it contain things like ViewControllers? The project will only contain resources related to that project.
Are there other frameworks that contain view controllers? I would say certainly so.
The bigger question would be "can it contain the resources I want to use with those view controllers?"
It is possible, but it is a pain in the neck. Here is some reference on how to do so.
Also the FaceBook developer kit is a good example of how to do it.
Yes, your framework can have view controllers.
Related
Ladies and gents,
I'm having a brain-itching issue with something I deem rather simple.
The case is as follows:
We created a native iOS app, and we want to create some customised versions of the app using the same source and resources. The project is rather large though, so creating multiple targets and linking against almost a 100 files would be overkill in my opinion. So I figured that it would probably be the best idea to create these customised versions of this app using a statically linked library of the original source. So I created multiple types of statically linked libraries using the many solutions our fellow developers provide on the internet. I've come across Jeff Verkoeyen's tutorial and the iOS Universal Framework, both providing me with an excellently built framework including my UIStoryboard files.
There's only one problem, after including the framework and finding the UIStoryboard files I've managed to get everything running. But after running the application the app instantly crashes notifying me that it couldn't find the custom classes I've used in the UIStoryboard to make the app work.
For instance, I've made subclasses for UIViewController (of which all my other ViewControllers inherit), so I could use my code more optimal. The actual subview (BaseViewController) is not to be found by the UIStoryboard. I'll have to note that the actual class files (.h and .m) are inside the framework I've created using any of the above methods.
So, what am I to do now. I really need a solution for either this problem or a hint to another solution that would be fitting for my current problem, which is; I want to create customised versions of apps using a single code base.
Thanks in advance!
Bryan
I'm currently trialing MonoTouch and am impressed with it's capabilities thus far.
I'm wanting to create a library of iPhone apps that each will have the same User Logon screen. Therefore, I want to create the LogonScreen ViewController once and then share it amongst my projects.
I tried adding the files as a 'link' like you do with files in Visual studio but that seemed to create a disjoint between the Login.cs and the Login.designer.cs ie the Login.Designer.cs does not appear underneath the Login.cs in the Solution explorer.
The Login.cs has also lost the reference to the txtUsername textbox control I have in my xib.
Any ideas on how to solve this problem?
If I'm understanding your problem correctly this will get you on track: Dimitris Tavlikos Answer
This will produce a custom class which you can abstract into a common library for your applications.
-Nick
Would advise you to add your shared views in a separated project (iOS Library Project) and add this project as a reference.
You won't have the problems of linking separate files in each future project, which would get more and more complicated when you will have more shared views.
The reason why you lost the reference to your textfield is because it 'lost' the designer.cs file, which has these references.
Can you provide me a basic iPhone example which has the following;
a. It is primarily a navigation-based app (Top-level view, Detail view, etc)
b. It also uses table (to present list of items, item details, add, edit, delete)
c. It uses Core Data for storing the list items
d. Optionally, it would be really great if it uses an API for retrieving some of the table data (otherwise user entered if API does not return).
While I do have individual examples for all these thing, I ma basically looking for an example which kind of combines all these things into a single app.
I have already gone through some of the IOS developer reference and hence would want other combined examples.
Any reference examples would be highly appreciated.
Thanks a lot.
Have you looked through the iOS Sample Code library? You'll find examples of all these. They have TopSongs (API, Navigation Views, Table Views, Core Data) and CoreDataBooks for Core Data.
If you create a project using the Navigation based template and select "Use Core Data" you will get the skeleton of exactly the type of app you want.
Examples covering all of those are on Apple's developer website, developer.apple.com.
I used this one is one, to learn this: http://icodeblog.com/2008/08/19/iphone-programming-tutorial-creating-a-todo-list-using-sqlite-part-1/#create-db
I'm writing code that will allow my iphone-app to have a "configuration page".
A grouped, scrolling, UITableView... with cells that contain the needed textFields, switches, sliders, etc.
It is an ENOURMOUS amount of code. Is there an easier way?
Is there a way I could create a simple text-file, contain all my desired design choices and have my (reusable) code build the TableView for me?
Or... can I just do the whole thing quicker/easier in Interface Builder instead of code?
Basically there are two approaches here :
you rely on what Apple gives you and implement a Bundle Settings (basically a dictionary that describes how the settings screen should look like), and then , your settings will be in the "Settings" application of the iPhone.
The drawback here is that what apple provides is quite limited and you won't be able to implement some of the most complicated settings you can see in "standard" (pre-installed) apple application settings.
That's why many developers are switching to "inapp" settings thanks to open source FWK or they reimplement everythingh from scratch but it can be a lot of code as you said.
You reimplement your own UIViewController for settings or you rely on some framework that will provide you the UIViewController to extend from and ease your implementation.
There are 2 good frameworks for that (Jesse cited one of them, but there's another one )
InAppSettings ( http://inscopeapps.com/blog/inappsettings-10/ )
InAppSettingsKit ( http://inappsettingskit.com/ )
A comparison of the two framework can be found here : http://inscopeapps.com/blog/inappsettings-vs-inappsettingskit/
(ok that's from one of the two authors but at least this gives an idea ;)
If you can live with the limitations of the standard application preferences in iPhone, you can actually create this using a settings bundle which only needs a plist and optionally a localized strings file.
You can check out Apple documentations for this:
http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationSettings/ApplicationSettings.html
Claus
If you're looking for a ready made and reusable solution, you can check
http://www.inappsettingskit.com/
It's open source too, so it's useful as a base.
I never found an easy and efficient way to build complicated table view by using Interface Builder, so I think programming the settings view is more preferable.
If you're talking about using a text file or plist, you may want to mimic the Settings Bundle design of Settings app.
Load the plist data upon the app launch.
I've built something like what you're looking for. Going off Claus's answer as well, it basically just duplicates the interface of the Settings application using the same settings.plist file as the settings app. The only difference is that it's a view controller that you can put inside the app. There's a surprisingly small amount of coding involved, it was just a lot of looking at the settings app to see exactly how things were laid out.
what if i have ecommerce application?
like i have
1)sale page
2)list of product page(grid view and list view)
3)detail of product
4) zoom images for that product.
what kind of template should i use?
i refer this post but its not clear.
New iPhone App - How to Choose which Xcode Template to Use?
Thanks
If you have a hierarchy of views in which you go from general to specific information, then you want the navigation template.
However, most of the time, the templates are just starting points for learning. In most cases, you will have an app that is a combination so you start with the generic windows-based template and then flesh it out yourself.
If there is a similar application on the AppStore you may like to see how they have approached it, generally there is something similar that can help you clarify how you would like your application to function.
From the sounds of your application idea you would probably be best served by the Navigation template. But after all it is only a template, you can completely change the structure of the application later without needing to start another project.