Search Results

Search found 1353 results on 55 pages for 'orientation'.

Page 8/55 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Determine UIInterfaceOrientation on iPad

    - by JustinXXVII
    I don't need to specify the orientation in this case, I just need to detect it, but I'm having trouble. I have conditional code that should only work in portrait, and if the device is in landscape I need to do something else. Since the deviceOrientation is not necessarily the same as the interfaceOrientation, I can't come up with a way to test for portrait mode. Most tutorials I find on Google are ways to force landscape or do some sort of rotation. The only thing I want to do is just determine what the orientation is. Here is my code, which is not working: -(void)viewDidLoad { [super viewDidLoad]; //currentOrientation is declared as UIInterfaceOrientation currentOrientation currentOrientation = [[UIApplication sharedApplication] statusBarOrientation]; NSLog(@"%@",currentOrientation); // == NULL } I need to determine the value of the interfaceOrientation and program conditionally. Thanks for your help!

    Read the article

  • AdMob and UINavigationControllers

    - by Ward
    I'm playing around with AdMob and I"m trying to get something going with an auto-rotating view inside a uinavigationcontroller. I have the ad at the top of the screen. Not sure if this is the right approach, but in my LoadView method I have: self.navigationController.view.frame = CGRectMake(0,48,320,432); The navbar appears below the ad. When I rotate the phone to landscape is there a way to get the navbar (which is now across the top) to be 432px wide so it doesn't get cut off under the ad? I tried writing a method that is called when the device orientation changes, but it seems like manipulating the view on the navigationcontroller screws things up for every orientation except portrait. The view keeps getting shorter until it disappears. Thanks, Howie

    Read the article

  • iphone/ipad application - taking screen shot

    - by satyam
    I successfully implemented an application that works on ipad as well as on iphone. In that I provided option to user to send the screen shot of the application as mail attachment. Even that is functioning well. But my code is taking screen shot irrespective of orientation. The image i'm getting is always in portrait mode. I want to take the screen shot depending on the orientation of ipad/iphone and send the image as attachment. I'm using following code to take the screen shot. UIGraphicsBeginImageContext(screenWindow.frame.size); [screenWindow.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();

    Read the article

  • popViewController does not autorotate back to allowed orientation

    - by JoeGaggler
    I have two UIViewControllers, "A" and "B", where "A" overrides the shouldAutorotateToInterfaceOrientation to return YES for UIInterfaceOrientationPortrait, and "B" returns YES for all orientations. In my example "A" is the root navigation view controller, and I then use pushViewController for "B". After that I rotate the device into landscape, which successfully autorotates "B", then I pop "B" (back button or via popViewController) to return to "A". When targetting iPhone OS 3.1.3, "A" returns to the portrait orientation as expected. When targetting iPhone OS 3.2, I have two side-effects: "A" is displayed in landscape. The navigation bar does not update even though "A" is now displayed. The navigation bar still shows the items for "B". Only after trying to go back/pop one more time will the navigation bar animate to show the items for "A". If I instead attempt to push "B" again and go back, I have to pop twice before the navigation bar animates to show the items for "A". During these "intermediate pops" the view for "A" remains displayed. While researching this issue, I have seen other answers suggesting performing the rotation manually ([UIDevice setOrientation] or via a tranformation), however this does not help understand what the problem is, especially why it behaves differently between the two OS's. So my question is: must all of my UIViewControllers on the UINavigationController stack support exactly the same orientations going forward? And if not, then is there something that I need to do to make it behave as it did for OS 3.1.3?

    Read the article

  • iPhone - UIViewController not rotating when device orientation changes

    - by Ryu
    I have got my own custom UIViewController, which contains a UIScrollView with an UIImageView as it's subview. I would like to make the image to auto rotate when device orientation changes, but it doesn't seem to be working... In the header file, I've got; @interface MyViewController : UIViewController <UIScrollViewDelegate> { IBOutlet UIScrollView *containerView; UIImageView *imageView; } These components are initialised in the loadView function as below; containerView = [[UIScrollView alloc] initWithFrame:frame]; NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://..."]]; UIImage *image = [[UIImage alloc] initWithData:data]; imageView = [[UIImageView alloc] initWithImage:image]; [image release]; [containerView addSubview:imageView]; And I have added the following method, assuming that's all I need to make the view auto-rotate... -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } MyViewController loads fine with the image I've specified to grab from the URL, and the shouldAutorotate... function is being called, with the correct UIInterfaceOrientation, when I flip the device too. However, didRotateFromInterfaceOrientation method do not get called, and the image doesn't seem to rotate itself... Could someone please point out what I need to add, or what I have done wrong here? Thanks in advance!

    Read the article

  • Manually changing keyboard orientation for a view that's on top of a camera view

    - by XKR
    I'm basically trying to reproduce the core functionality of the "At Once" app. I have a camera view and another view with a text view on it. I add both views to the window. All is well so far. [window addSubview:imagePicker.view]; [window addSubview:textViewController.view]; I understand that the UIImagePickerController does not support autorotation, so I handle it manually by watching UIDeviceOrientationDidChangeNotifications and applying the necessary transforms to the textViewController.view. Now, the problem here is the keyboard. If I do nothing, it just stays in portrait mode. I can get it to rotate by adding the following code to the notification handler. [[UIApplication sharedApplication] setStatusBarOrientation:interfaceOrientation]; [textView resignFirstResponder]; [textView becomeFirstResponder]; However, the following simple test produces weird behavior. Start the app in portrait mode. Rotate the device 90 degrees clockwise. Rotate the device 90 degrees counterclockwise (back to the initial position). Rotate the device 90 degrees clockwise. After step 4, instead of the landscape-mode keyboard, the portrait-style keyboard is shown, skewed to fit in the landscape keyboard frame. Perhaps my approach is wrong from the start. I was wondering if anyone has been able to reliably make the keyboard change its orientation in response to setStatusBarOrientation.

    Read the article

  • Landscape orientation for UITabBarController?

    - by gingersnap
    The UITabBarController does not allow landscape orientation. So I used a subclass of UITabBarContoller (called RotatingTabBarController). Its sole purpose it to allow rotation by returning YES to shouldAutorotateToInterfaceOrientation call. The problem is that when you rotate the iPhone in simulator it gives the following malloc error. malloc: *** error for object 0x3888000: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug I am using 3.0 SDK with Xcode 3.2 on Snow Leopard. I set a breakpoint in malloc_error_break but I can not trace it back to my code. Is there something I can do to make this error go away? Here is the RotatingTabBarController class: #import <UIKit/UIKit.h> @interface RotatingTabBarController : UITabBarController { } @end @implementation RotatingTabBarController -(BOOL)shouldAutorotateToInterfaceOrientation:UIInterfaceOrientation)interfaceOrientation { return YES; } @end Update: I tried the same with a category. But it gives the same malloc error. // UITabBarController+Rotation.h @interface UITabBarController (rotation) - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation; @end // UITabBarController+Rotation.m #import "UITabBarController+Rotation.h" @implementation UITabBarController (rotation) - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } @end Backtrace [Session started at 2009-09-05 12:13:19 -0400.] Untitled(992,0xa06d9500) malloc: *** error for object 0x2024000: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug Untitled(992,0xa06d9500) malloc: *** error for object 0x2014000: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug [Session started at 2009-09-05 12:13:27 -0400.] GNU gdb 6.3.50-20050815 (Apple version gdb-1344) (Fri Jul 3 01:19:56 UTC 2009) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-apple-darwin".Attaching to process 992. sharedlibrary apply-load-rules all (gdb) bt #0 0x951908fa in mach_msg_trap () #1 0x95191067 in mach_msg () #2 0x30244d62 in CFRunLoopRunSpecific () #3 0x30244628 in CFRunLoopRunInMode () #4 0x32044c31 in GSEventRunModal () #5 0x32044cf6 in GSEventRun () #6 0x309021ee in UIApplicationMain () #7 0x00002608 in main (argc=1, argv=0xbfffef94) at /Users/vishwas/Desktop/Untitled/main.m:13 (gdb)

    Read the article

  • I can't set a border around my StackPanel. Any help?

    - by Sergio Tapia
    Here's my XAML code: <Window x:Class="CarFinder.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Search for cars in TuMomo" Height="480" Width="600"> <DockPanel Margin="8"> <Border CornerRadius="6" BorderBrush="Gray" Background="LightGray" BorderThickness="2" Padding="8"> <StackPanel Orientation="Horizontal" DockPanel.Dock="Top" Height="25"> <TextBlock FontSize="14" Padding="0 0 8 0"> Search: </TextBlock> <TextBox x:Name="txtSearchTerm" Width="400" /> <Image Source="/CarFinder;component/Images/Chrysanthemum.jpg" /> </StackPanel> </Border> <StackPanel Orientation="Horizontal" DockPanel.Dock="Top" Height="25"> </StackPanel> </DockPanel> </Window> The border is set around the entire window. And also, when I create another StackPanel it's added to the right of my previous StackPanel instead of being added under it. What's the reason for this?

    Read the article

  • Can I add a portrait layout on top of a landscape Camera SurfaceView?

    - by Uwe Krass
    My application should hold a camera preview surface. The camera is fixed to landscape view via AndroidMainfest.xml <application android:icon="@drawable/icon" android:label="Camera"> <uses-library android:name="com.google.android.maps" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <activity android:name=".CameraPreview" android:label="Camera" android:screenOrientation="landscape"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> If there is another way to get the camera preview itself to behave correctly, please let me know. Now I need to have an overlay that holds a bunch of buttons. Due to usability, the user interface should be set to portrait view (or even better orientation aware). Is there a way to have a transparent layout (for buttons and other GUI elements) in portrait orientation? I tried to write a special rotated layout by extending a RelativeLayout, but the onDraw method isn't called at anytime. public class RotatedOverlay extends RelativeLayout { private static final String TAG = "RotatedOverlay"; public RotatedOverlay(Context context, AttributeSet attrs ) { super(context, attrs); } @Override protected void onDraw(Canvas canvas) { canvas.rotate(90); super.onDraw(canvas); } I am quite new to the Android plattform programming. Of course I dont know much about the programming tricks and workarounds yet. I did a lot of research over the last two weeks (even studied the native Camera implementation), but couldnt find a good solution so far. Maybe it works with two seperate Activities, but I dont think, that this can the right solution.

    Read the article

  • Android - How to approach fall detection algorithm

    - by bobby123
    I want to be able to feature a fairly simple fall detection algorithm in my application. At the moment in onSensorChanged(), I am getting the absolute value of the current x,x,z values and subtracting SensorManager.GRAVITY_EARTH (9.8 m/s) from this. The resulting value has to be bigger than a threshold value 10 times in a row to set a flag saying a fall has been detected by the accelerometer, the threshold value is about 8m/s. Also I'm comparing the orientation of the phone as soon as the threshold has been passed and the orienation of it when the threshold is no longer being passed, this sets another flag saying the orientation sensor has detected a fall. When both flags are set, an event occurs to check is user ok, etc etc. My problem is with the threshold, when the phone is held straight up the absolute value of accelerometer is about 9.8 m/s, but when i hold it still at an angle it can be over 15m/s. This is causing other events to trigger the fall detection, and if i increase the threshold to avoid that, it won't detect falls. Can anyone give me some advice here with what possible values i should use or how to even improve my method? Many thanks.

    Read the article

  • How can I flip/rotate a PrintDocument in .NET ?

    - by Simon_Weaver
    I have a document that I want to be flipped / rotated 180 degrees when printed. (This is due to the orientation of label stock in the printer). There is a property PrintDocument.PrinterSettings.LandscapeAngle but it is read only. I think this property is influenced by the printer driver and therefore not 'settable'. Is there a nice way i can rotate the print by 180 degrees without having to do anything too nasty?

    Read the article

  • iPhone rotation on demand

    - by yosh
    Is there a way to manually check current position of device AND ask device to automatically rotate it without waiting for user to actually rotate the device? Currently I control the rotation with several IFs in -shouldAutorotateToInterfaceOrientation but in few situations I have to stop the view from rotating and enable it again and I don't want user to rotate the device twice to have the desired orientation.

    Read the article

  • UITableView with sectionIndexTitle bugs on rotation

    - by Toto
    Hi everyone, I have a UITableView with a sectionIndexTitles, and when I do a rotation, some cells are displayed like if I were on the previous orientation. When I don't have sectionIndexTitles, there is no problem. Is it just a bug in a library, or is there a secret tip I don't know to fix it ? Tank you

    Read the article

  • [Android] Is disabling landscape mode unforgivable?

    - by Nicolas Raoul
    Our application could support landscape mode without any problem, but it is such a pain that we are thinking about forcing portrait mode. Question: Is it BAD? The main problem is that changing orientation generates random crashes on many screens. Avoiding those crashes would potentially allow us to spend more time on the core aspects of the app. Will the same crashes happen when users switch apps anyway? Also, are there landscape-oriented devices where our app will become useless?

    Read the article

  • Android - Saving an object in onSaveInstanceState?

    - by Donal Rafferty
    I have created a small XML parsing application for Android that displays information in a listview and then allows a user to click on the list view and a dialog with further info will pop up. The problem is that when the screen orientation is changed when a dialog screen is open I get a null pointer error. The null pointer occurs on the following line: if(setting.getAddForPublicUserNames() == 1){ This line is part of my dialogPrepare method: @Override public void onPrepareDialog(int id, Dialog dialog) { switch(id) { case (SETTINGS_DIALOG) : afpunText = ""; if(setting.getAddForPublicUserNames() == 1){ afpunText = "Yes"; } else{ afpunText = "No"; } String Text = "Login Settings: " + "\n" + "Password: " + setting.getPassword() + "\n" + "Server: " + setting.getServerAddress() + "\n" + "Register: " + setting.getRegistrarAddress() + "\n" + "Realm: " + setting.getRealm() + "\n" + "Public UserNames: " + afpunText + "\n" + "Preference Settings: " + "\n" + "Request VDN: " + setting.getRequestVDN() + "\n" + "Handover Settings: " + "\n" + "Enable Handover: " + setting.getEnableHandover() + "\n" + "Hand Over Number: " + setting.getHandoverNum() + "\n"; AlertDialog settingsDialog = (AlertDialog)dialog; settingsDialog.setTitle("Auth ID: " + setting.getUserName()); tv = (TextView)settingsDialog.findViewById(R.id.detailsTextView); if (tv != null) tv.setText(Text); break; } } So the error is that my variable setting is null after the screen orientation changes. I have tried to use the onSaveInstance state methods to fix that as follows: @Override public void onSaveInstanceState(Bundle savedInstanceState) { for(int i = 0; i < settings.size(); i++){ savedInstanceState.putString("Username"+i, settings.get(i).getUserName()); savedInstanceState.putString("Password"+i, settings.get(i).getPassword()); savedInstanceState.putString("Server"+i, settings.get(i).getServerAddress()); savedInstanceState.putString("Registrar"+i, settings.get(i).getRegistrarAddress()); savedInstanceState.putString("Realm"+i, settings.get(i).getRealm()); savedInstanceState.putInt("PUserNames"+i, settings.get(i).getAddForPublicUserNames()); savedInstanceState.putString("RequestVDN"+i, settings.get(i).getRequestVDN()); savedInstanceState.putString("EnableHandOver"+i, settings.get(i).getEnableHandover()); savedInstanceState.putString("HandOverNum"+i, settings.get(i).getHandoverNum()); } super.onSaveInstanceState(savedInstanceState); } and @Override public void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); //Check to see if this is required // Restore UI state from the savedInstanceState. // This bundle has also been passed to onCreate. for(int i = 0; i<settings.size(); i++){ settings.get(i).setUserName(savedInstanceState.getString("Username"+i)); settings.get(i).setPassword(savedInstanceState.getString("Password"+i)) ; settings.get(i).setServerAddress(savedInstanceState.getString("Server"+i)); settings.get(i).setRegistrarAddress(savedInstanceState.getString("Registrar"+i)); settings.get(i).setRealm(savedInstanceState.getString("Realm"+i)); settings.get(i).setAddForPublicUserNames(savedInstanceState.getInt("PUserNames"+i)); settings.get(i).setRequestVDN(savedInstanceState.getString("RequestVDN"+i)); settings.get(i).setEnableHandover(savedInstanceState.getString("EnableHandOver"+i)); settings.get(i).setHandoverNum(savedInstanceState.getString("HandOverNum"+i)); } } However the error still remains, I think I have to save the selected setting from what was selected from the ListView? But how do I save a setting object in onSavedInstance?

    Read the article

  • [android] Screen Orientation Landscape back to Portrait not working

    - by marc
    Hello, I've racked my brain for hours over this issue. I have created a main.xml and designed one for the res/layout-land (landscape) format and another one for portrait in res/layout. When I rotate the emulator (ctrl-F11), my app rotates properly to landscape using the correct main.xml, but a subsequent rotation back to portrait just keeps the landscape mail.xml. This was done in a 2.0 AVD.. Out of despiration I downloaded the new Sample Code for Multiple Resolutions and had to create a new 2.1 AVD, to my surprise rotation with this app works correctly as expected. So I then decided to try my app on the 2.1 AVD and it works perfectly. So, is this a Bug in a 2.0 AVD or is there something special I need to be doing for < 2.1 SDK versions? This is driving me crazy because no where did anyone mention this issue. Thanks in advance

    Read the article

  • How can I set the Inital Orientation for a UISplitViewCOntroller-based iPad App

    - by MystikSpiral
    I have a split view app running fine on the iPad. It is using the default setup (Popover in Portrait, table view on the left in landscape). The views shift correctly once the app is running. The problem I am seeing is that when the app starts (in the simulator) running in landscape mode the UI paradigm is the one intended for Portrait mode (Master List is a popover) is what loads. I am thinking this is some strangeness with the simulator, or I am missing an option on my main view controller.

    Read the article

  • PHP, jQuery and Ajax Object Orientation

    - by pastylegs
    I'm a fairly experienced programmer getting my head around PHP and Ajax for the first time, and I'm having a bit of trouble figuring out how to incorperate object oriented PHP into my ajax webapp. I have an admin page (admin.php) that will load and write information (info.xml) from an XML file depending on the users selection of a form on the admin page. I have decided to use an object (ContentManager.php) to manage the loading and writing of the XML file to disk, i.e : class ContentManager{ var $xml_attribute_1 ... function __construct(){ //load the xml file from disk and save its contents into variables $xml_attribute = simplexml_load_file(/path/to/xml) } function get_xml_contents(){ return xml_attribute; } function write_xml($contents_{ } function print_xml(){ } } I create the ContentManager object in admin.php like so <?php include '../includes/CompetitionManager.php'; $cm = new CompetitionManager() ?> <script> ...all my jquery </script> <html> ... all my form elements </html> So now I want to use AJAX to allow the user to retrieve information from the XML file via the ContentManger app using an interface (ajax_handler.php) like so <?php if(_POST[]=="get_a"){ }else if() } ... ?> I understand how this would work if I wasn't using objects, i.e. the hander php file would do a certain action depending on a variable in the .post request, but with my setup, I can't see how I can get a reference to the ContentManager object I have created in admin.php in the ajax_handler.php file? Maybe my understanding of php object scope is flawed. Anyway, if anyone can make sense of what I'm trying to do, I would appreciate some help!

    Read the article

  • programmatically change device orientation in iphone

    - by iPhoneDev
    I have navigation based app, when I click on any row in root view, the next view should come in Landscape mode. I am not able to find a proper way to implement this. What I tried is: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return UIInterfaceOrientationIsLandscape(interfaceOrientation); } But this is not working. The view should open only in Landscape mode (not when user rotate it). Can any one help me. Thanks

    Read the article

  • UIDEVICE orientation

    - by hardik
    hello all i have my splash screen which i want to show in landscape mode and all other screen in potrait mode. My root view controller is acting as a splash screen i am writing this code in viewdidload method [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight]; But this code is not working and shows me that UIdevice may not respond to setorentation please guide me that how could i change the orentation for only first splash screen and also other screen should be in potrait mode

    Read the article

  • Finding text orientation in image (angle for rotation)

    - by maximus
    There is an image captured by camera, and I need to find the angle of the text in order to rotate it to make the image better for OCR results. So I know that the fourier transform can be used for that purpose, My question is, does it really gives good results or may be it is better to use something different than that? Can you tell me if there is a good method for this purpose? I am afraid that not every image containing the text will give me a good result after using fourier transform method. Actually, if I make like it is written here: link text (see the part related with an example of text image) calculating the logarithm of the magnitude of the Fourier transform of image with text and then thresholding it, I get that points and I can calculate the line approximately passing through them, and after getting the line calculate the angle, and then make an affine transform, But, what if I do not get a good result every time using this method , and make a false transform? Any ideas please to judge wether the result is correct or not, or may be another method is better? The binary image can contain noise, even if there are not so much of them, the angle found as a result can be not accurate.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >