I like to have uniformity in my application style for my mobile.How to apply the styles to my control in the Iphone app ..Something similar to android resource files.. Even i hope thats one of the good pattern to follow in the application develovpment
Buttons can be styled by using
creating a custom button.
Custom views can be created using Interface builder or via code inheriting the UIview. A sample tutorial can be found here
You can create custom uitableview and uitableview cells too.
Resource files in android application is what Interface builder provides you in Xcode to create xib (nibs) for your ui layout.
Related
I am making a iPhone app using phone gap in that I want to add a tab bar Controller either using HTML or by using native components to it. Can anyone suggest to me how to do that.
If you are using phonegap/cordova versions 1.5+ you can create a native tabbar with this plugin: https://github.com/AndiDog/phonegap-ios-tabbar-plugin
Other phonegap/cordova plugins can be found here: https://github.com/phonegap/phonegap-plugins/tree/master/iOS
Here's a tutorial how to implement this: http://zsprawl.com/iOS/2012/03/using-the-native-tabbar-plugin-in-cordova/
This is of course the best approach. Other one would be to use a jQuery Mobile and create a HTML tabbar. This is a harder way because it will take time to style it properly and even then it would not fully act as a native tabbar.
I want to make an NSToggleButton because it suits my needs perfectly: show one image when toggled on, another when it's toggled off.
From Apple's Developer website:
"After the first click, the button displays its alternate image or title; a second click returns the button to its normal state.
This option is called “Toggle” in Interface Builder’s Button Inspector.
Available in OS X v10.0 and later."
- Source
When looking at the Round Rect Button I created in Interface Builder, however, I can't find a "Toggle" attribute. My google and StackOverflow searches yield only questions around attributes for the control, but I haven't found a tutorial for creating this button in particular.
How do I create a NSToggleButton in Interface Builder? Where is it in the Object library?
The source you provdided is for OSX programming. Not iOS however this can be implemented yourself. A UIButton is just a UIView so add a UIImageView as a subview then when the button is clicked set hidden to either YES or NO
NSToggleButton is an AppKit class -- MacOS X only. You won't find it if you're building an iOS app. Classes from the Foundation framework have an NS prefix and are available in iOS (NSArray, NSDictionary, etc.), but the user interface classes in iOS are in UIKit and have a UI prefix. Take a look at UISwitch for similar functionality.
I've created a View Based Application in XCode4; when creating the application I selected iPhone as the Device Family:
The application was created with the following files:
I designed the UI on the TestushViewController.xib file and without adding any code in the Delegate files, the application is uploading immediately to the TestushViewController.xib view and I'm very happy about it.
Now I want to add an iPad xib. How do I do that?
(I knew how to do it in XCode 3, but I used some code in the Delegate file, and now if I try to use the same code it doesn't work because the template default implementation works differently - Apple uses #class TestushViewController and self.window.rootViewController = self.viewController and it goes directly to the iPhone.xib. I don't know how to go around it without changing the entire thing to the way it was done in XCode3)
You'll need to structure your code in a similar way that the Window Template does. The file structure that template uses when the "Universal" option is ticked at creation is:
App Name/
AppNameAppDelegate
iPhone/
AppNameAppDelegate_iPhone
MainWindow_iPhone.xib
iPad/
AppNameAppDelegate_iPad
MainWindow_iPad.xib
The iPhone and iPad AppDelegates are simply subclasses of the AppNameAppDelegate
#interface YourAppNameAppDelegate_iPhone : YourAppNameAppDelegate {}
In your target summary you can set what .xib file is initially loaded for each device. It is called the "Main Interface" and has a pulldown menu.
Quite frankly, if you're wanting to do a universal app (iPhone + iPad) it's probably easier just to start with the Window Template and add in your view controllers instead of starting with the View template and trying to change it up.
I have 2 projects. One is a library that I am compiling to a .a file and the other is the application. The library has a class (AdFactoryView) that extends UIView that is used to display ads. Previously I was creating the AdFactoryView programmatically calling initWithFrame, now I'm trying to put the class directly into a nib and use it from there. I can find the class in the interface builder library, add it and link up the reference to an IBOutlet but when the code runs I get a message that says:
Unknown class AdFactoryView in Interface Builder file.
And the IBOutlet contains a UIView instead of an AdFactoryView. How do I get the view from my library to work correctly?
Extra information:
The application is built by importing the .a and .h files for the library. I have another project that references the entire library project directly that I use for testing, in this project AdFactoryView does not show up in interface builder.
Edit: This suddenly started working in my application project, though I still can't see the custom views in interface builder in my test project.
I need to write an app that runs for iPhone and iPad.
The issue I'm running into is how do you setup an iPadView and an iPhoneView to hook to the same controller?
In other words, I don't want to have any duplicate controller code--I should only have to make a different view for each device.
Right now I link up view->controller by choosing "Add->New File->iPhone View with Controller", and this works for one device. But the code in the event handlers I have wired up should not have to be duplicated by going to "Add->New File->iPad View with Controller".
A link to a tutorial may help, I have been doing .Net Windows development for a while but still learning iPhone and MonoTouch.
This link talks about code generation for .xib files:
MonoTouch Doc
Apparently you can just delete your .xib.designer.cs file to turn off the code generation. Is this the right way to do it?
Otherwise I'll mark this as the answer.
Can you not just have a base controller and then inherit from that in both view controllers?