Large buttons in appcelerator - iphone

I have created an app in Titanium Appcelerator. The app worked fine up until the iPhone 5 came out and ios 6. The issue is in the button bar the buttons are larger than they should be. They overlap the bar.
Here is an image as well as the code for the button. Has anyone ran into this issue before?
http://postimage.org/image/thlu3i8pf/
var statusButton = Titanium.UI.createButtonBar({
labels:['Open', 'Closed'],
backgroundColor:'#336699'
});

Make sure you're using Titanium SDK 2.1.4 or newer -- 2.1.3 & 2.1.4 contain a number of fixes for iOS 6 and iPhone 5.

You need to add height.
var statusButton = Titanium.UI.createButtonBar({
labels:['Open', 'Closed'],
backgroundColor:'#336699',
height: 40
});

Related

Sencha Touch 2 textfield's focus issue in iOS 7

I'm having an issue with textfields in Sencha Touch 2, this is only occurring in iOS 7 and working fine in iOS 6 and Android.
The issue is when you tap a field the keypad opens but the cursor disappears, it should be focus on selected textfield but it does not. You have to tap the textfield again to focus.
I have checked this issue on iOS 6 and android (on devices as well as on simulators), working fine but not on iOS 7 only.
Is anybody having this issue...?
Is this a bug in sencha or should i missing something, please advice.
Thank you..
I have found this to be directly related to two things:
centered: true
pack: 'center'
When I removed those lines, my app started playing nice. The challenge is to find an alternative way to center your panels.
I spent days figuring this out. Actually there is a problem with Sencha understanding the ViewPort height. In your index.html add a script block with the following code
if (window.device && parseFloat(window.device.version) == 7.0) {
document.body.style.paddingTop = "20px";
Ext.Viewport.setHeight(Ext.Viewport.getWindowHeight() - 20);
}
This does two things for you
It Provides enough space on Top to display the activity bar
It sets the Viewport height to be that of screen height, irrespective of the keyboard being present or not.
Also, If your app works in Portrait and Landscape mode, you will need to add these lines in your Viewport.js (or Main.js)
initialize: function(){
Ext.Viewport.on('orientationchange', 'handleOrientationChange', this, {buffer: 0 });
},
handleOrientationChange: function(){
try{
if (parseFloat(window.device.version) == 7.0) {
Ext.Viewport.setHeight(Ext.Viewport.getWindowHeight() - 20);
}else{
Ext.Viewport.setHeight(Ext.Viewport.getWindowHeight());
}
}catch(e){
// do nothing
}
},
And Yes, Make sure they Keyboard Bounce is TRUE in true (if you are using cordova). This will make sure your field does not get hidden.
Hope this works for you.
add height="device-height" in viewport meta tag, fixes the issue.
ios7 issues with webview focus when using keyboard html

Tabgroup does not open with IOS 6 simulator in titanium studio

I'm new to mobile development with Titanium Studio. I was using tabgroup controller and it was working fine with IOS simulator version 5.1. But when I upgraded to IOS 6, when I tried running the same code I got the error below,
Script Error = -[UITabBarController setSelectedViewController:] only a view controller in the tab bar controller's list of view controllers can be selected. at app.js (line 45).
And here is my code:
var tabGroup = Titanium.UI.createTabGroup();
var win = Titanium.UI.createWindow({
navBarHidden: true,
tabBarHidden: true,
url:'example.js',
});
var tab1 = Titanium.UI.createTab({
height: 30,
window:win,
});
tabGroup.addTab(tab1);
tabGroup.addEventListener('open', function(){
tabGroup.setActiveTab(tab1);
})
tabGroup.open();
Please tell me if I can do something to solve it. Or if I can downgrade the simulator to 5.1 because I don't find the IOS simulator 5.1 in Run Configuration.
Thanks in advance.
This is fixed by updating your titanium SDK to the latest version. (Currently 2.1.3 RC2 http://developer.appcelerator.com/blog/2012/09/titanum-2-1-3-rc2-is-released-with-additional-fixes-for-ios-6-and-iphone-5.html)
I had the same issue and this fixed it for me.

iPhone 5 splashscreen not displaying correctly - Phonegap

I'm updating my PhoneGap iOS-app to make it compatible with the iPhone 5.
I'm manually hiding the splash screen after my app has initialized.
When simulating iPhone 5: When the app starts it displays the correct splash screen (Default-568h#2x.png) (hereon "the 5") but quickly hides it and instead displays the iPhone 4 splash screen (hereon "the 4"). The 4 doesn't cover the whole app, thus showing top and bottom bars of the app initializing.
I'm not entirely sure how it works but I can think of two possible scenarios:
1) Both images are displayed simultaneously but for some reason the 5 auto hides while the 4 waits for the call from the app to hide.
2) At some point when disabling manually hiding the splash screen phonegap switches out the "true" splashscreen for a "fake" one that is displayed until the javascript call from the app and phonegap just might not display correct one after this switcheroo.
Has anyone else encountered and / or solved this?
UPDATE:
Tried removing and adding all splash images again but to no avail. I tried removing the smaller images (the 4 and its non-retina version) but even without the smaller ones present anywhere in the project I get the same error!
UPDATE 2:
Cordova 2.2.0 has now been released, thus fixing this issue according to: http://shazronatadobe.wordpress.com/2012/10/27/whats-new-in-cordova-ios-2-2-0/
So, the recommended solution would therefore be to update your app to use Cordova 2.2.0, if that is for some reason not possible, solutions are provided below.
I've received two answers elsewhere but haven't had time to test them out yet:
From user T123 in the Phonegap Google Group:
open CDVViewController.m -- find - (void) showSplashScreen
change about line: 690
From :
else // not iPad
{
orientedLaunchImageFile = launchImageFile;
}
To:
else // not iPad
{
orientedLaunchImageFile = launchImageFile;
/* Edited for 4-inch IP5 */
if(screenBounds.size.height == 568)
orientedLaunchImageFile = [NSString stringWithFormat:#"%#-568h", launchImageFile];
}
And from Brion who commented above, the following pull request, hoepfully to be incorporated into Cordova 2.2.0: https://github.com/apache/incubator-cordova-ios/pull/50
EDIT: Tried T123's solution and it's working for me!
EDIT2: Brion's fix was incorporated in Cordova 2.2.0 which has now been released!
EDIT3: Just updating to highlight a comment for those who don't bother reading them:
For Phonegap version 1.4.1, I managed to get Hessius's fix to work like this: I copied the methods showSplashScreen, isIPad, resolveImageResource and the definition #define degreesToRadian(x) (M_PI * (x) / 180.0) from the file PGViewController.m to my MainViewController.m file. After that, XCode complained that I was assigning values to read-only attributes, so I edited the header file in PhoneGap.framework to make those two attributes readwrite. I also changed launchImageFilefrom Hessius's code to #"Default". This did the trick for me. – Joe Dyndale Oct 8 '12 at 15:23
The fix for this (https://issues.apache.org/jira/browse/CB-1482) is not out until 2.2. It is very risky to use the unstable version and I don't bother to compile from source code myself, so I tried the following hack:
In MainViewController.m
- (void) showSplashScreen
{
CGRect screenBounds = [[UIScreen mainScreen] bounds];
// HACK: PhoneGap pre-2.2 does not support iphone5 splash image well, so we just skip it
if (screenBounds.size.height == 568) {
return;
}
[super showSplashScreen];
}
This will disable showSplashScreen for iPhone5 to avoid the shorter launch image added by PhoneGap (iOS initial launch image is showing up fine). It worked for me and I barely notice any difference by hacking off showSplashScreen for iPhone5.
White Flicker
I was having this same problem with Cordova 2.2. I think it is worth mentioning that I had to take an added step in order to get the splash screen to render correctly.
I made the changes that were included in #Hessius answer. But I noticed that a white screen flash was produced after the splash screen appeared.
In the (void)showSplashScreen method others may see
if (launchImageFile == nil) { // fallback if no launch image was specified
// if (CDV_IsIPhone5()) {
// // iPhone 5 or iPod Touch 6th-gen
// launchImageFile = #"Default-568h";
// } else {
launchImageFile = #"Default";
// }
}
Commenting the code out(or removing) that I have commented, eliminated the white flicker I was seeing in between app load and launch screen.
Hope this helps someone!

XCode 4.2 and SDK 4.3 have Custom button font issue?

I'm using custom button (label button). Works fine on SDK 5.0 but when I simulate to SDK 4.3 it gives me bigger font. Does anyone know what would be the issue is?
Yes, fonts have changed beetween SDK4.3 and SDK5. SDK4.3 default fonts where bolder/bigger that the one set by default in SDK5. What is the reason of this... I don't know. You should set yourself the wanted font instead of using the default system one to have a similar rendering in both case.

iPhone "page curl" icon is disappered in iOS 5

Does not SDK page curl icon anymore?
page curl icon is used on native map app (http://www.filemaker.com/products/bento/iphone/1/help/en/images/icon_page_curl.png)
I can assign page curl icon in iOS 5, but icon does not appear on tool bar.
this icon is appear in under iOS 5.
do you have any idea of this?
I just got answer from Apple that the problem has been determined and is a known issue.
So we all can just hope they will fix this in iOS 5.1 release.
I found this person created their own page curl icon. You can use this one (it's under an open license):
http://blog.shuningbian.net/2011/01/ios-toolbar-pagecurl-icon.html
I just took this, resized the image to 20x20 and plan used it in a custom UIBarButtonItem it in my app. It doesn't look quite as nice as apple's, but it works!
Alternatively you can give this tool a shot to try and extract the icon from UIKit on a version 4 device:
https://github.com/0xced/UIKit-Artwork-Extractor