Hi am using storyboard to design UI my entire application.It will support Portrait mode for all screen except reports screen.In Reports i have to show huge data so it should be in landscape mode.And also using tabbar controler.
My Question is 1. :is there any possible to support different orientation in storyboard?
P.S: i have tried to rotate view to landscape mode its working fine but am unable to hide tab bar and status bar in my application for particular screen.
2.It possible to handle orientation programatically for all scene?(to support portrait/landscape)
P.S: I have changed my plist to support landscape left/right.But it roating to landscape for all screen.i tried below code for my landscape but its not woking .
-(BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationMaskLandscape;
}
Please guide me.thanks in avance
I'm rendering multiple layers to get one final image. One of the images contains a face, and another one contains a background with a transparent gradient around the face so that the real background is hidden. In iOS6 it works perfectly but it is creating a weird effect with the transparent gradient in iOS7.
The code:
CGRect rect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[faceImageView.layer renderInContext:context];
[fakeBackgroundImageView.layer renderInContext:context];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
The results in iOS6 and iOS7:
Ok, the solution was changing this line:
UIGraphicsBeginImageContext(rect.size);
for this one:
UIGraphicsBeginImageContextWithOptions(rect.size, TRUE, [[UIScreen mainScreen] scale]);
Now it also works in iOS7
What I want is my whole application is in portrait mode only.
And it working fine in ios 6+. The only support required at now.
But the problem is I need to launch UIImagePickerViewController with image source type camera in only landscape mode.
What I tried till now is:
(1) I try to create one category for UIImagePickerController for orientation.
-(BOOL)shouldAutorotate
{
return NO;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeLeft;
}
Like this. But the camera view is not proper aligned. It just follows the orientation of device with some +/- 90 angle but not what I required.
Even the button of the camera shown by camera view as camera control is also follows the camera view, ie. the view is rotated to 90 anti clock vise and stays to that way.
I use the below code to present the image picker view controller
[self presentViewController:imagePicker animated:YES completion:nil];
Is there any way to use the camera with proper alignment? or have to use other framework to work with it?
In my apps I use CircularProgressBar from http://sachabarber.net/?p=639.
In one app I place it on AdornerLayer I get from Image element and it works as expected (i.e. the element is animated by rotation driven by a timer).
In another app I place it on AdornerLayer I get from ListBox element and it's shown but not animated. It does get animated while I resize the window which I think means that for some reason AdornerLayer is not being redrawn when the element changes (unless I force a refresh e.g. by resizing a window).
It is also properly animated when I hold Alt key (I have no theory to explain this).
In both cases I use this code to create an adorner:
var adornerLayer = AdornerLayer.GetAdornerLayer(ListBoxDirOrImageElement);
if (null == adornerLayer)
return;
var vb = new Viewbox();
vb.Width = 16;
vb.Height = 16;
vb.Child = new CircularProgressBar();
var adorner = new UpperRightAdorner(ListBoxDir, vb);
adornerLayer.Add(adorner);
The only difference I've noticed so far between the 2 programs is the element I'm adorning (works on Image, doesn't work on ListBox).
Any thoughts why that might be and how to fix that or some other explanation why adorner on ListBox is not being repainted/animated?
I want to achieve the same effect as Windows Media Player or Browser based Flash players which take up the ENTIRE (not even the taskbar is visible) real estate when maximized.
This works fine if the WindowState is set to Maximized and the WindowStyle is set to None in XAML so the app is started in that state. Problem is I want to start the app in a bordered window and when the user chooses, maximize as specified above. In the StateChanged handler I check for Maximized state and if this is the case I set the WindowStyle to None. This has the effect of maximizing the window but NOT covering the taskbar. The following code will make this work as I want but its a hack and I'd like to clean it up:
if (WindowState == WindowState.Maximized)
{
m_videoWindow.Maximize();
WindowStyle = WindowStyle.None;
//the following makes this work but I would like to clean it up
Hide();
Show();
}
EDIT This (from 2006 when still in CTP) mentions the problem and someone from MS states they hope to improve full screen support in the next version, have these improvements been made?
This article explains it all: Maximizing window (with WindowStyle=None) considering Taskbar.
Also worth checking out: Custom Window Chrome in WPF.
Edit: Now new, is the WPF Shell Integration Library that allows complete restyle of the window chrome without the headaches of reimplementing move, resizing, etc.
Edit 2015: Shell Integration Library is now integrated in WPF and MS retired the code
I found I could maximize to full screen (covering the taskbar) by setting the properties when creating the window (in xaml), but was not able to switch back and forth after creation. After some experimenting, I found the order the properties are set seems to matter:
public bool IsFullscreen
{
get
{
return WindowState == System.Windows.WindowState.Maximized
&& ResizeMode == System.Windows.ResizeMode.NoResize
&& WindowStyle== System.Windows.WindowStyle.None;
}
set
{
if ( value )
{
ResizeMode = System.Windows.ResizeMode.NoResize;
WindowStyle = System.Windows.WindowStyle.None;
WindowState = System.Windows.WindowState.Maximized;
}
else
{
ResizeMode = System.Windows.ResizeMode.CanResize;
WindowStyle = System.Windows.WindowStyle.SingleBorderWindow;
WindowState = System.Windows.WindowState.Normal;
}
}
}
Note that WindowState comes last in the setter.
To get this to properly work in my WPF/.NET 4.0 application I am calling this function whenever I enter or exit full screen mode:
private static void RefreshWindowVisibility(Window window)
{
if (window.OriginalWindowState == WindowState.Maximized)
{
window.Hide();
window.Show();
window.BringIntoView();
}
}
There is a flicker associated with this method, but it seems the same flicker exists when going to full screen mode on Chrome. Internet Explorer seems to take a different approach.
I don't know if this is ok for you, but you can resize the window to have the same size than the working area (that is, in most cases, all the screen except the taskbar) and locate it at 0,0 (top-left corner):
Width = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width;
Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height;
Left = 0;
Top = 0;
The exact definition for the WorkingArea property (from MSDN) is:
Gets the working area of the display. The working area is the desktop area of the display, excluding taskbars, docked windows, and docked tool bars.
Hope it helps