How to link a ViewController in Xamarin MonoTouch - iphone

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.

Related

Can Emmet Be Used to Create FXML?

I have a scalaFX app that currently has its views created programmatically. I am wondering if I can use the Emmet tool to create FXML (particularly ScalaFXML) because I want to recreate my views in ScalaFXML to separate my views from my controllers more effectively. I have searched the internet and cannot find out if this is possible. So far I have only used Emmet for HTML. Thanks in advance for the help!
I have been looking around for something for PrimeFaces; I had trouble finding anything. I guess maybe it's because people who are using it are actually writing "normal" HTML with JS frameworks.
The good news is, it's completely (and easily!) customizable: just find the installation directory, and edit the "snippets.json" file, or create a new one called (for example) snippets-scalaFX.json. Mine on a Windows 10 machine, installed as a plugin for NPP, was C:\Program Files (x86)\Notepad++\plugins\EmmetNPP\emmet\snippets.json.
It's pretty obvious once you get in there, but inside the "snippets" object just add some more fields for yourself. For example, to make a PrimeFaces commandButton tag I added:
"pc": "p:commandButton"
You can use $0 or ${<placeholder text>} to define tabstops for expanded snippets, and | to define the caret starting point.
Full docs on editing snippets are here.

Creating a static library + UI from existing source

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

Simplest Way To Create Custom Builds of the Same App, Different Assets

I'm building an iPhone app that will be branded for several different companies. Each company will get their own app. The code base is the same. Really, the only thing that will be different between them are the app name, app icon, default image, and a few images used inside the app. Is there a best practice to automate this? I am pursuing scripting everything and have some preliminary scripts somewhat working, but it occurred to me there may be a simpler way with Xcode 4.
Any suggestions?
Thanks.
You'll need to create a new workspace and add a new project for every own app. You won't need to create all classes for every project. Just create a "core" project with your code base and add his files by reference to the custom projects.
i have same scenario , in which we maintain a global-config File which contain all UI Elements like NavBar , Buttons everything , as we have same layout for all clients , so we maintain a same layout with different color Theme the client choose,.
so for distribution , we change the settings in global file , then add the Client Provision ,& will send for review.
Hope this Helps

Common, reusable iPhone-App configuration screen

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.

How to Choose which Xcode Template to Use?

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.