How is it possible to change the title of the UIBarButtonItem's when using mfmailcomposeviewcontroller? I don't want the text "cancel"/"send" and I also do not need the save/delete draft option which prompt the user when he/she taps "cancel".
You can't. MFMailComposeViewController is not customizable.
You can change the Development Region in your Info.plist so that your system buttons will be translated, or add translations in your app and the system buttons will be translated to the user's selected language.
Note: This is probably a duplicate with this question
Thats because you have set it with a system item "style" UIBarButtonSystemItem.
You have these to use, or use a custom one:
UIBarButtonSystemItemDone,
UIBarButtonSystemItemCancel,
UIBarButtonSystemItemEdit,
UIBarButtonSystemItemSave,
UIBarButtonSystemItemAdd,
UIBarButtonSystemItemFlexibleSpace,
UIBarButtonSystemItemFixedSpace,
UIBarButtonSystemItemCompose,
UIBarButtonSystemItemReply,
UIBarButtonSystemItemAction,
UIBarButtonSystemItemOrganize,
UIBarButtonSystemItemBookmarks,
UIBarButtonSystemItemSearch,
UIBarButtonSystemItemRefresh,
UIBarButtonSystemItemStop,
UIBarButtonSystemItemCamera,
UIBarButtonSystemItemTrash,
UIBarButtonSystemItemPlay,
UIBarButtonSystemItemPause,
UIBarButtonSystemItemRewind,
UIBarButtonSystemItemFastForward,
UIBarButtonSystemItemUndo, // iOS 3.0 and later
UIBarButtonSystemItemRedo, // iOS 3.0 and later
UIBarButtonSystemItemPageCurl, // iOS 4.0 and later
Oh i did not see the "Translating" from the title..
Related
I have a task to clone an application of... I can't change the client mind, pls do not suggest it.
I can't found where is hidden in iOS this 2 buttons. I think it is coming from iOS, not just a The buttons looks like: and .
I am searching a code part, something like this:
refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:#selector(doStuff)];
but can't found a button share at:
typedef NS_ENUM(NSInteger, UIBarButtonSystemItem) {
UIBarButtonSystemItemDone,
UIBarButtonSystemItemCancel,
UIBarButtonSystemItemEdit,
UIBarButtonSystemItemSave,
UIBarButtonSystemItemAdd,
UIBarButtonSystemItemFlexibleSpace,
UIBarButtonSystemItemFixedSpace,
UIBarButtonSystemItemCompose,
UIBarButtonSystemItemReply,
UIBarButtonSystemItemAction,
UIBarButtonSystemItemOrganize,
UIBarButtonSystemItemBookmarks,
UIBarButtonSystemItemSearch,
UIBarButtonSystemItemRefresh,
UIBarButtonSystemItemStop,
UIBarButtonSystemItemCamera,
UIBarButtonSystemItemTrash,
UIBarButtonSystemItemPlay,
UIBarButtonSystemItemPause,
UIBarButtonSystemItemRewind,
UIBarButtonSystemItemFastForward,
#if __IPHONE_3_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED
UIBarButtonSystemItemUndo,
UIBarButtonSystemItemRedo,
#endif
#if __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED
UIBarButtonSystemItemPageCurl,
#endif
};
in
UIBarButtonItem.h
Any help would be appreciated where to look at.
Need to support iOS 5.0
Edit: can't accept the answer with UIBarButtonSystemItemAction, because it looks like:
As you can see, it is not the "clone" of original, bar far away, because it is missing the description ( text under icon), checked the UITabBarSystemItem, since those has text under icon, but nothing match the 2x images:
typedef NS_ENUM(NSInteger, UITabBarSystemItem) {
UITabBarSystemItemMore,
UITabBarSystemItemFavorites,
UITabBarSystemItemFeatured,
UITabBarSystemItemTopRated,
UITabBarSystemItemRecents,
UITabBarSystemItemContacts,
UITabBarSystemItemHistory,
UITabBarSystemItemBookmarks,
UITabBarSystemItemSearch,
UITabBarSystemItemDownloads,
UITabBarSystemItemMostRecent,
UITabBarSystemItemMostViewed,
};
It seems need to search a custom library and get those 2 icons for or make 2x custom buttons with those images.
UIBarButtonSystemItemAction is what you are looking for the Share.
The settings icon doesn't exist as a system icon so you have to use a custom button with an image.
Here is an example on how to create a Bar Button with a custom image
EDIT:
As long as the share button is not exactly the same with what you want, add two custom buttons if you want the icons to look exactly as the native ones.
Kind reminder: Apple doesn't like it when developers immitating their custom controls when they aren't using the defaults.
If you want to make a multilingual button on a native iPhone app, where it can be one language by default, but based on your settings, show different text on the same button, how would you go about it?
Is it also possible to style (e.g. with text-shadows and custom fonts) the text on the button?
I'm not an iOS developer, but I'm attempting to provide designs for an iOS developer and don't understand the limitations (yet) when going from CSS3 to iOS UI elements.
So far, iOS development appears to be like creating image-maps where none of the CSS logic is applicable from web development and almost all UI elements appear to need all states as flattened images. I thought the controls were more dynamic but haven't found the right terminology for results from google to be very forthcoming on the topic.
U can use NSLocalizedString for multilingual text on button.
Configuring Button Title
titleLabel property
reversesTitleShadowWhenHighlighted property
– setTitle:forState:
– setTitleColor:forState:
– setTitleShadowColor:forState:
– titleColorForState:
– titleForState:
– titleShadowColorForState:
Also set Custom font like this:
yourButton.titleLabel.font = [UIFont fontWithName:#"Courier" size:22.0];
if u want to add gradient to button then u will have to use CALayer like this:
yourButton.layer = //any modification in button's layer here
For more refer UIButton class reference
I posted a question about mimicking the interface of the Maps application and have just come across another area where i'm unsure about the UIToolbar and UIBarButtonItem's.
In the Maps application, there are two buttons which don't seem to have any constant defined in the UIBarButtonItem documentation
At the bottom left of the app is the "location" icon and when clicking "directions" there is another "switch route" icon, neither of which are defined in the UIBarButtonItem.h
I'm guessing that these haven't been added to iOS 4 yet? Does this mean that the only way to include such buttons/images is to use the initWithImage:style:target:action: method when creating a UIBarButtonItem?
This isn't a problem, although finding similar images would be pain, I just want to make sure i'm, not reinventing the wheel when trying to include such elements.
Also, I note that whilst all the other UI elements can be styled in terms of color, the PageCurl button item doesn't seem to want to change at all. Ie: I can make all of the other toolbar buttons a different color to the default but the page curl refuses to change. Perhaps i'm missing something simple here?
Thanks for reading!
Correct, from the iOS documentation here are the only system icons available by default. You can safely assume that nothing outside of this list exists and you have to use your own image for it if you want something different:
typedef enum {
UIBarButtonSystemItemDone,
UIBarButtonSystemItemCancel,
UIBarButtonSystemItemEdit,
UIBarButtonSystemItemSave,
UIBarButtonSystemItemAdd,
UIBarButtonSystemItemFlexibleSpace,
UIBarButtonSystemItemFixedSpace,
UIBarButtonSystemItemCompose,
UIBarButtonSystemItemReply,
UIBarButtonSystemItemAction,
UIBarButtonSystemItemOrganize,
UIBarButtonSystemItemBookmarks,
UIBarButtonSystemItemSearch,
UIBarButtonSystemItemRefresh,
UIBarButtonSystemItemStop,
UIBarButtonSystemItemCamera,
UIBarButtonSystemItemTrash,
UIBarButtonSystemItemPlay,
UIBarButtonSystemItemPause,
UIBarButtonSystemItemRewind,
UIBarButtonSystemItemFastForward,
UIBarButtonSystemItemUndo, // iOS 3.0 and later
UIBarButtonSystemItemRedo, // iOS 3.0 and later
UIBarButtonSystemItemPageCurl, // iOS 4.0 and later
} UIBarButtonSystemItem;
In iPhone App I want to change the fontstyle throughout ( in whole App) the App
so is there any quicker way of doing that. suppose I want display all font in style "impact" ,
How can I set fontstyle "impact" throughout the app ?
Please Help and Suggest.
The SDK does not allow you to change font settings on an application-wide basis. If you want to change the default font, you have to do it on a per-object basis.
Also, are you sure that this is a good idea? Changing the default font to "Impact" might not have the "impact" you're looking for...
I usually use a Settings.bundle so the user can choose what font they would like to see throughout the app. This is done on a per object basis as Dave suggests.
Per Object:
[myLabel setFont:[UIFont fontWithName:[[NSUserDefaults standardUserDefaults] stringForKey:#"kFontStyle"]
size:[[NSUserDefaults standardUserDefaults] integerForKey:#"kFontSize"]]];
In a UIWebView:
This is an example of how I use them when loading HTML into a UIWebView
header = [[NSString stringWithFormat:#"<html><head><style>body{background-color:transparent;font-family:%#;font-size:%#px;color:#960000;}</style></head><body><div align='left'><center><img width='290' height='56' src='0%i.jpg'></center><br>",[[NSUserDefaults standardUserDefaults] stringForKey:#"kFontStyle"],[[NSUserDefaults standardUserDefaults] int stringForKey:#"kFontSize"],courseIndex] retain];
footer = #"</font></font></font></div></body></html>";
[myWebView loadHTMLString:[NSString stringWithFormat:#"%#%#%#",header,[courseItem objectForKey:#"Content"],footer] baseURL:[NSURL fileURLWithPath:bundle]];
You could subclass UIFont and override methods like systemFontWithSize: to return your custom font. You could even do this in a category for UIFont. I do agree with Dave though, be careful with custom fonts.
I just have a quick question. In the 1Password app on the iPhone/iPad when you tap the password field it gives you a non-standard option in the context-menu. I was wondering how this could be recreated with some other non-standard options like "Copy/Email/Something else".
** This does not pertain to passwords and text masking
Custom Action Menu Options http://cl.ly/b8e92af85937086308f3/content
On the iPad, and on the iPhone running OS 4.0 or later, you can use UIMenuController class's menuItems property. If they're doing the same thing on iOS versions prior to 3.2, then it's probably a custom-built view that just looks like the usual context menu.