Search Results

Search found 935 results on 38 pages for 'landscape portrait'.

Page 16/38 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • UISplitView show different views in the detail pane

    - by Mark
    How can I change the view in the Details pane of the UISplitView so that its a completely different view? Im having a fair amount of trouble understanding how its all wired up and where things should go at the moment, could someone please enlighten me? What I would love to be able to do is to show a specific view based on what the user has selected in the UITableView on the left pane (this view could be an image, or a more complex view of a news article, etc... many different options) then when the user turns the iPad into portrait view, that view that was in the details pane changes to be its equivalent portrait view version. Does this make sense? How on earth would I do that? Just to brainstorm, here is what I was thinking: Create a Split View project Create 2 NIBs for each view: (with accompanying view controllers???) * PortraitNewsStory * LandscapeNewsStory * PortraitImageBrowser * LandscapeImageBrowser * etc... Create a UISplitView control using XCode Capture when a user rotates the iPad (should this be done in the RootViewController.m ?) Change the view of the DetailViewController how should I do this? profit??? Thanks Mark

    Read the article

  • OrientationEventListener not working properly

    - by nixau
    Hi all, I need to handle orientation changes in my Android application. For this purpose I decided to use OrientationEventListener convenience class. But his callback method is given somewhat strange behavior. My application starts in the portrait mode and then eventually switches to the lanscape one. I have some custom code executing in the callback onOrientationChanged method that provides some additional UI handling logic - it has a few calls to findViewById. What is strange is that when switching back from landscape to portrait mode onOrientationChanged callback is called twice, and what's even worse - the second call is dealing with bad Context - findViewById method starts returning null. These calls are made right from the MainThread @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); listener = new OrientationListener(); } @Override protected void onResume() { super.onResume(); // enabling listening listener.enable(); } @Override protected void onPause() { super.onPause(); // disabling listening listener.disable(); } I've replicated the same behavior with a dummy Activity without any logic except for one that deals with orientation hadling. I initiate orientation switch from the Android 2.2 emulator by pressing Ctrl+F11 What could be wrong? Upd: Inner class that implements OrientationEventListener private class OrientationListener extends OrientationEventListener { public OrientationL() { super(getBaseContext()); } @Override public void onOrientationChanged(int orientation) { toString(); } } }

    Read the article

  • Only first UIView added view addSubview shows correct orientation

    - by Brian Underwood
    I've got three ViewControllers set up to handle three views. The problem that I'm having is that in the simulator the orientation is LandscapeRight (which is what I want), and the first view shows up correctly in that landscape view, but when I move onto the second and third views, they show up rotated 90 degrees counter-clockwise with the upper-left corner of the view in the lower left corner of the phone's screen. I've been trying to debug this for a few days and the closest that I've gotten to a clue is tracing it the following way: The following is in my app delegate's applicationDidFinishLaunching: NSLog(@"1"); [window addSubview:welcomeController.view]; NSLog(@"2"); [window addSubview:goalController.view]; NSLog(@"3"); [window addSubview:planningController.view]; NSLog(@"4"); [window bringSubviewToFront:welcomeController.view]; NSLog(@"5"); Each of my ViewControllers implement something similar to the following (the only change being the controller's name switched out in the string passed to NSLog): - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations NSLog(@"called for WelcomeController"); return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); } With that, I get the following output on the Console: a called for WelcomeController called for WelcomeController called for WelcomeController called for WelcomeController 2 called for GoalController 3 called for PlanningController 4 5 I find it interesting that shouldAutorotateToInterfaceOrientation is called 4 times for the first view that's added, while the other two only get called once. I expect that this is probably because it's got to do some setup at first (and I believe that the simulator starts off in portrait mode, so it's might be calling it while doing the rotation), but I find the correlation a bit suspicious. I've switched the order around so that the addSubview is called for the goalController first and the welcomeController second. In this case, it's the goalController which displays in the correct landscape orientation (it's normally the welcome controller). This would seem to eliminate my XIB files and the ViewControllers themselves. I'm not sure why the first view where addSubview is called is special. I also tried using insertSubview at index 0 with the same results.

    Read the article

  • Rotate UIViewController to counteract changes in UIInterfaceOrientation

    - by Peter Hajas
    Hi there, I've been searching a lot on this, and can't find anything to help me. I have a UIViewController contained within another UIViewController. When the parent UIViewController rotates, say from Portrait to LandscapeLeft, I want to make it look as though the child didn't rotate. That is to say. I want the child to have the same orientation to the sky regardless of the parent's orientation. If it has a UIButton that's upright in Portrait, I want the right-side of the button to be "up" in UIInterfaceOrientationLandscapeLeft. Is this possible? Currently, I'm doing really gross stuff like this: -(void) rotate:(UIInterfaceOrientation)fromOrientation: toOr:(UIInterfaceOrientation)toOrientation { if(((fromOrientation == UIInterfaceOrientationPortrait) && (toOrientation == UIInterfaceOrientationLandscapeRight)) || ((fromOrientation == UIInterfaceOrientationPortraitUpsideDown) && (toOrientation == UIInterfaceOrientationLandscapeLeft))) { } if(((fromOrientation == UIInterfaceOrientationLandscapeRight) && (toOrientation == UIInterfaceOrientationPortraitUpsideDown)) || ((fromOrientation == UIInterfaceOrientationLandscapeLeft) && (toOrientation == UIInterfaceOrientationPortrait))) { } if(((fromOrientation == UIInterfaceOrientationPortrait) && (toOrientation == UIInterfaceOrientationLandscapeLeft)) || ((fromOrientation == UIInterfaceOrientationPortraitUpsideDown) && (toOrientation == UIInterfaceOrientationLandscapeRight))) { } if(((fromOrientation == UIInterfaceOrientationLandscapeLeft) && (toOrientation == UIInterfaceOrientationPortraitUpsideDown)) || ((fromOrientation == UIInterfaceOrientationLandscapeRight) && (toOrientation == UIInterfaceOrientationPortrait))) { } if(((fromOrientation == UIInterfaceOrientationPortrait) && (toOrientation == UIInterfaceOrientationPortraitUpsideDown)) || ((fromOrientation == UIInterfaceOrientationPortraitUpsideDown) && (toOrientation == UIInterfaceOrientationPortrait))) { } if(((fromOrientation == UIInterfaceOrientationLandscapeLeft) && (toOrientation == UIInterfaceOrientationLandscapeRight)) || ((fromOrientation == UIInterfaceOrientationLandscapeRight) && (toOrientation == UIInterfaceOrientationLandscapeLeft))) { } } which seems like a perfectly good waste of code. Furthermore, I was planning on using CGAffineTransform (like cited here: http://www.crystalminds.nl/?p=1102) but I'm confused about whether I should change the view's dimensions to match what they will be after the rotation. The big nightmare here is that you have to keep track of a global "orientation" variable. If you don't, the illusion is lost and the ViewController is rotated into whatever. I could really use some help on this, thanks!

    Read the article

  • lscape and supertabular in Latex

    - by Tim
    Hi, I would like to put pictures into a supertabular table within lscape enviroment. The code is: \newcounter{themenumber} \newcounter{classnumber} \newcounter{imagenumber} \tablefirsthead{ \hline \backslashbox{Concept}{Class} &\multicolumn{3}{|c|}{Class 0} & \multicolumn{3}{|c|}{Class 1} \\ %\textbf{A} & \textbf{B}\\ \hline} \tablehead{ \hline \multicolumn{7}{|l|}{\small\sl continued from previous page}\\ \hline \backslashbox{Concept}{Class} &\multicolumn{3}{|c|}{Class 0} & \multicolumn{3}{|c|}{Class 1} \\ %\textbf{A} & \textbf{B}\\ \hline} \tabletail{ %\hline \multicolumn{7}{|l|}{\small\sl continued on next page}\\ \hline} \tablelasttail{} %\tablelasttail{\hline} \begin{landscape} \begin{supertabular}{| c || c | c | c || c | c | c |} \topcaption{Examples of All the Concepts. \label{tab:conceptsimgs}} \forloop{themenumber}{1}{\value{themenumber} < 24}{ \arabic{themenumber} \forloop{classnumber}{0}{\value{classnumber} < 2}{ \forloop{imagenumber}{1}{\value{imagenumber} < 4}{ & \includegraphics[scale=0.5]{../\arabic{themenumber}/\arabic{classnumber}_\arabic{imagenumber}.eps} } } \\ \hline } \end{supertabular} \end{landscape} However there is something wrong with the result: no caption is shown, the height of the part of table in each page exceeds the page height and there is something extra unwanted at the last page. See images below: page1 page2 page3 page4 How to fix the problems? Thanks and regards!

    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 cannot rotate views in TabBar controller

    - by Luc
    Hello, I am working on an application that consists of a TabBar controller. Within on of its tab, I have a subclass of UITableViewController, within this list I have a Core-plot graph in the first cell and some other data in the 4 following cells. When I return YES in the shouldAutorotateToInterfaceOrientation method, I would expect the autoresizing of the list view to happen, but... nothing. When I add some log in the willRotateToInterfaceOrientation method, they are not displayed. Is there something I missed ? Thanks a lot, Luc // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations //return (interfaceOrientation == UIInterfaceOrientationPortrait); NSLog(@"Orientation"); return YES; } - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; NSLog(@"Rotating"); if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) { NSLog(@"view land:%@", self.view); } if (toInterfaceOrientation == UIInterfaceOrientationPortrait) { NSLog(@"view portrait:%@", self.view); } }

    Read the article

  • Automatically Sizing UIView after Adding to Window

    - by Kristopher Johnson
    I have an iPad app that switches between different views in its main window. The view-switching code looks like this: - (void)switchToViewController:(UIViewController*)viewController { if (currentViewController != viewController) { [currentViewController.view removeFromSuperview]; currentViewController = viewController; [window addSubview:viewController.view]; } } The problem is that when the new view (a UISplitView) appears in landscape orientation, it is not sized to fill the entire window. There is an empty black space on the right. If I rotate the device and then rotate back, the view sizes itself properly. If the device is in portrait orientation, everything works fine. The UISplitView also gets sized properly if it is the first view I show. The problem only occurs if I switch to it after another view has been shown, in landscape. So, is there some way to force iPhone OS to resize the view after it has been added to the window? I've tried calling sizeToFit, but it didn't work. I've also tried setting the view's bounds to the window's bounds, and I've tried setting the frame.

    Read the article

  • Resizing layouts for orientation change?

    - by Cole
    Normal: Landscape: See how the ListView overlaps other things on the screen when in landscape mode? How can I keep this from happening? XML: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/main" > <RelativeLayout android:id="@+id/myWishLists" android:layout_width="fill_parent" android:layout_height="50dp"> <Spinner android:id="@+id/spinner1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:prompt="@string/optionsSpinner" android:entries="@array/options" /> </RelativeLayout> <TextView android:id="@+id/myListsText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/myWishLists" android:layout_centerHorizontal="true" android:text="My Wish Lists" android:textStyle="bold" android:textAppearance="?android:attr/textAppearanceLarge" /> <RelativeLayout android:id="@+id/listsList" android:layout_width="fill_parent" android:layout_height="445dp" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true"> <ListView android:id="@+id/lists" android:layout_width="fill_parent" android:layout_height="fill_parent" android:entries="@array/entries" > </ListView> </RelativeLayout> </RelativeLayout>

    Read the article

  • Toolbar hiding on rotated UISplitView DetailView

    - by Gerry
    I've based my app on Apple's SplitView project type. I have a TableView as the Master, and am using different types of views as the Detail view. To select types of detail view, I'm using the fancy concept of buttons on my DetailView toolbar. When the DetailView is derived from UIViewController, everything is good. When the DetailView derives from UIViewController, but contains a UITableView then I have problems. In portrait view the toolbar is visible. In landscape mode the toolbar is hidden, even though the Tableview is moved down to allow space for it. The UIToolbar and UITableView are both defined in my NIB file which is loaded to create the detail view. Why is my toolbar invisible in landscape? BTW, is this the best way to choose Detail view types with UISplitView? Bonus question, what if selecting a row in my DetailView tableview should bring up another View, I can't push it like I would with a NaviagtionController, so how do I go back to the detail tableview? Thanks, Gerry

    Read the article

  • An annoying printing issue with Crystal Reports 2008

    - by Xience
    A little background: I have an extremely annoying printing issue with crystal reports. My environment is crystal reports 2008 SP2 on Windows 7 (64bit), Visual studio 2008 and .net framework 3.5 with all the latest updates for everything. The report is designed basically to render a small shelf label of the size (40mm width and 20mm height). In crystal when I set the page size to the above mentioned values and set orientation to portrait and take a preview, everything is displayed as i expect it to be and issuing a print command, it prints absolutely correct. The problem: The problem comes when i print this report from my program (in vb.net), dynamically setting data to some text fields, the result is that crystal somehow changes the print orientation, NOT the paper orientation as in portrait or landscape. Instead of printing from top left towards the bottom right, it rotates the whole output at 90 degrees to the left and reduces everything so small that it is barely visible, although it prints everything out. I have tested it on Intermec PF8t and Zebra GK420d label printers and a whole bunch of laser printers, but with the above stated page settings the output is always the same. Another strange thing that i noticed while experimenting with page sizes if i switch to landscape mode, the print out is correct in its font sizes and positions but then the text gets truncated due to overflowing the page size. Can anyone help me with this. Does crystal has anything like its own print drivers or something. I have tried to ensure to the best of my abilities that it is not a printer driver problem.

    Read the article

  • Why isn't my UITableView in a popover appearing in the correct scroll position?

    - by zbrimhall
    I have a split view-based app that presents a master-detail interface, and uses a popover to present the master list when in portrait mode. The popover presents a sectioned table view that ultimately gets populated by a subclass of NSFetchedResultsController. I can tap the tool bar button to present the master list, scroll to whatever row, and tap the row to dismiss the popover. My problem is that if the table is scrolled past the top of the second section, when I dismiss the popover and then later tap the toolbar button to re-present it, the table's scroll position is always set such that the first row of the second section is at the top of the list. If I haven't scrolled past the top of the second section, it correctly remembers its scroll position when the table is presented again. Similarly, in landscape mode, if I scroll the table past the top of the third section and then rotate to portrait, when I come back to landscape the scroll position is always set such that the first row of the third section is at the top of the list. I tried calling -scrollToNearestSelectedRowAtScrollPosition:animated in both the master view controller's -viewWillAppear, as well as in the split view delegate's splitViewController:popoverController:willPresentViewController:, to no effect. Anybody have a clue what I might be doing wrong?

    Read the article

  • Easiest way to support multiple orientations? How do I load a custom NIB when the application is in

    - by Peter Hajas
    Hi there, I have an application in which I would like to support multiple orientations. I have two .xib files that I want to use, myViewController.xib and myViewControllerLandscape.xib. myViewController.xib exists in project/Resources and myViewControllerLandscape.xib exists in the root project directory. What I want to do is use a separate NIB (myViewControllerLandscape.xib) for my rotations. I try detecting rotation in viewDidLoad like this: if((self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight)) { NSLog(@"Landscape detected!"); [self initWithNibName:@"myViewControllerLandscape" bundle:nil]; } But I can see in gdb that this isn't executed when the app is started with the device in landscape. The NSLog message doesn't fire. Why is this? What have I done wrong? Also, if I explicitly put the initWithNibName function call in the viewDidLoad method, that nib is not loaded, and it continues with the myViewController.xib file. What's wrong with my call? Should I specify a bundle? Thanks!

    Read the article

  • Getting an Android App to Show Up in the market for "Sony Internet TV"(Google TV)

    - by user1291659
    I'm having a bit of trouble getting my app to show up in the market under GoogleTV. I've searched google's official documentation and I don't believe the manifest lists any elements which would invalidate the program; the only hardware requirement specified is landscape mode, wakelock and external storage(neither which should cause it to be filtered for GTV according to the documentation) and I set the uses touchscreen elements "required" attribute to false. below is the AndroidManifest.xml for my project: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.whateversoft" android:versionCode="2" android:versionName="0.1" > <uses-sdk android:minSdkVersion="8" /> <application android:icon="@drawable/ic_launcher" android:label="Color Shafted" android:theme="@style/Theme.NoBackground" android:debuggable="false"> <activity android:label="Color Shafted" android:name=".colorshafted.ColorShafted" android:configChanges = "keyboard|keyboardHidden|orientation" android:screenOrientation = "landscape"> <!-- Set as the default run activity --> <intent-filter > <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:label="Color Shafted Settings" android:name=".colorshafted.Settings" android:theme="@android:style/Theme" android:configChanges = "keyboard|keyboardHidden"> <!-- --> </activity> </application> <!-- DEFINE PERMISSIONS FOR CAPABILITIES --> <uses-permission android:name = "android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name = "android.permission.WAKE_LOCK"/> <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> <!-- END OF PERMISSIONS FOR CAPABILITIES --> </manifest> I'm about to start promoting the app after the next major release so its been kind of a bummer since I can't seem to get this to work. Any help would be appreciated, thanks in advance : )

    Read the article

  • GridView: How can I get rid of extra space from my GirdView object?

    - by Lajos Arpad
    Hello, I'm writing an application for Android phones for Human vs. Human chess play over the internet. I was looking at some tutorials, to learn how to develop Android applications and found a very nice example of making galleries (it was a GridView usage example for making a gallery about dogs) and the idea came to draw the chess table using a GridView, because the example project also handled the point & click event and I intended to use the same event in the same way, but for a different purpose. The game works well (currently it's a hotseat version), however, I'm really frustrated by the fact that whenever I rotate the screen of the phone, my GridView gets hysterical and puts some empty space in my chess table between the columns. I realized that the cause of this is that the GridView's width is the same as its parent's and the GridView tries to fill its parent in with, but there should (and probably is) be a simple solution to get rid of this problem. However, after a full day of researching, I haven't found any clue to help me to make a perfect drawing about my chess table without a negative side effect in functionality. The chess table looks fine if the phone is in Portrait mode, but in Landscape mode it's far from nice. This is how I can decide whether we are in Portrait or Landscape mode: ((((MainActivity)mContext).getWindow().getWindowManager().getDefaultDisplay().getWidth()) < ((MainActivity)mContext).getWindow().getWindowManager().getDefaultDisplay().getHeight()) In the main.xml file the GridView is defined in the following way: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:numColumns="8" android:verticalSpacing="0dp" android:horizontalSpacing="0dp" android:stretchMode="columnWidth" android:gravity="center" > </GridView> ... </LinearLayout> I appreciate any help with the problem and thank you for reading this.

    Read the article

  • Problems when handling orientation changes

    - by nixau
    Hi all, I need to handle orientation changes in my Android application. For this purpose I decided to use OrientationEventListener convenience class. But his callback method is given somewhat strange behavior. My application starts in the portrait mode and then eventually switches to the lanscape one. I have some custom code executing in the callback onOrientationChanged method that provides some additional UI handling logic - it has a few calls to findViewById. What is strange is that when switching back from landscape to portrait mode onOrientationChanged callback is called twice, and what's even worse - the second call is dealing with bad Context - findViewById method starts returning null. These calls are made right from the MainThread @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); listener = new OrientationListener(); } @Override protected void onResume() { super.onResume(); // enabling listening listener.enable(); } @Override protected void onPause() { super.onPause(); // disabling listening listener.disable(); } I've replicated the same behavior with a dummy Activity without any logic except for one that deals with orientation hadling. I initiate orientation switch from the Android 2.2 emulator by pressing Ctrl+F11 What could be wrong? Upd: Inner class that implements OrientationEventListener private class OrientationListener extends OrientationEventListener { public OrientationL() { super(getBaseContext()); } @Override public void onOrientationChanged(int orientation) { toString(); } } }

    Read the article

  • How do I reliably get the size of my iPhone view taking rotations into consideration?

    - by Sebastian Celis
    My application uses a UITabBarController, multiple UINavigationControllers, and supports autorotation. In order to properly layout the subviews within each UIViewController's main view, I really need to know the size available to the UIViewContoller. I need this size to take the UINavigationBar, the UITabBar, and the status bar all into account, and thus only return the size available to the content view. I thought for sure I could use the following from within the UIViewController's code: CGRect viewControllerBounds = [[self view] bounds]; However, there are a couple of issues with this approach: The first time the view is loaded, viewControllerBounds reports the view as being 320 pixels wide by 460 pixels tall. This is wrong. With a status bar and a navigation bar showing, the height should only be 416 pixels. However, if I rotate the simulator to landscape and then rotate back, the height of viewControllerBounds changes to 416. If I rotate the first view in the navigation controller to landscape mode and then push another view controller onto the stack, viewControllerBounds for the new view reports a width of 300 pixels and a height of 480 pixels. So the view's bounds didn't even take the rotation into account. Is there a better way to do this? I really don't want to have to start hardcoding the widths and heights of all the various UI elements the iPhone OS provides. I have tried setting the autoresizing mask of the UIViewController's view, but that doesn't seem to change anything. The views definitely seem to be displaying properly. When I set a background color that view looks like it takes up all of the space available to it. Any pointers would be greatly appreciated.

    Read the article

  • I need some help cropping an image in PHP (GD)

    - by evan
    http://i.imgur.com/foT9u.jpg Using that image as an example, here's what I need to do: Crop the blue square to have the same proportional ratio as that of the black square From doing that, I should then be able to resize the blue square to fit into the black square without losing stretching it - It'll retain its proportions. Note: The blue square must be cropped 'from the center'. The original center should remain the center after the crop (it can't be cropped from the top left, for example). Here's what I'm thinking needs to be done (using the, landscape, blue square as the example): Figure out the difference between the black squares width and height Figure out the difference between the blue squares width and height This should tell me how much to crop the blue square by and with how much of a 'top offset' Once it's cropped to fit the black squares proportions, it can then be resized I've been messing around with code similar to: if (BLACK_WIDTH > BLACK_HEIGHT) { $diffHeight = BLACK_WIDTH - BLACK_HEIGHT; $newHeight = $blue_Height - $blue_Height; echo $newHeight; } And using Photoshop to try and get a feel for how this should be done, but it continues to fail .< How should I go about doing this? How can I figure out how much to crop by (depending on if the blue square is landscape or portrait)? How do I then get the offset to retain the blue squares center?

    Read the article

  • PHP Thumbnail Image Resizing with proportions

    - by Sam
    Hi all. As a brief run down, I am currently making a dating type site. Users can create accounts and upload profile pictures (up to 8). In order to display these in the browse area of the website, I am looking for a way in PHP (with third party processor/scripts) to resize all images uploaded to have thumbnails that adhere to certain dimensions. As an example, I will want "profile" images (thumbnails) to be NO larger than 120*150px. The scripting needs to resize uploaded images (regardless of whether they are portrait or landscape, and regardless of proportions) to adhere to these dimensions without getting stretched. The width (eg. 120pixels) should always remain the same, but the height (eg. 150px) can vary in order to keep the image in proportion. If it's a landscape photo, I'm assuming the script would need to take a chunk out of the middle of the image? The reason that all images to be resized is so that when profiles are display in a grid that all thumbnails are roughly the same size. Any input would be greatly appreciated.

    Read the article

  • Why isn't my UITableView appearing in the correct scroll position?

    - by zbrimhall
    I have a split view-based app that presents a master-detail interface, and uses a popover to present the master list when in portrait mode. The popover presents a sectioned table view that ultimately gets populated by a subclass of NSFetchedResultsController. I can tap the tool bar button to present the master list, scroll to whatever row, and tap the row to dismiss the popover. My problem is that if the table is scrolled past the top of the second section, when I dismiss the popover and then later tap the toolbar button to re-present it, the table's scroll position is always set such that the first row of the second section is at the top of the list. If I haven't scrolled past the top of the second section, it correctly remembers its scroll position when the table is presented again. Similarly, in landscape mode, if I scroll the table past the top of the third section and then rotate to portrait, when I come back to landscape the scroll position is always set such that the first row of the third section is at the top of the list. I tried calling -scrollToNearestSelectedRowAtScrollPosition:animated in both the master view controller's -viewWillAppear, as well as in the split view delegate's splitViewController:popoverController:willPresentViewController:, to no effect. Anybody have a clue what I might be doing wrong?

    Read the article

  • iOS - Rotating view reveals background.

    - by Jack
    Hi, I have created a view that I want to be able to rotate. The two views are: containerView and this has a .backgroundColor of red and BackgroundImage as a subview. Here is my code for rotating: - (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { [self adjustViewsForOrientation:toInterfaceOrientation]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } - (void) adjustViewsForOrientation:(UIInterfaceOrientation)orientation { if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) { backgroundImage.image = [UIImage imageNamed:@"landscape.jpg"]; backgroundImage.frame = CGRectMake(0, 0, 1024, 704); containerView.frame = CGRectMake(0, 0, 1024, 704); self.title = @"landscape"; } else if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) { backgroundImage.image = [UIImage imageNamed:@"portrait.jpg"]; backgroundImage.frame = CGRectMake(0, 0, 768, 960); containerView.frame = CGRectMake(0, 0, 768, 960); self.title = @"portrait"; } } The problem is that the image rotates, but the background color is shown whilst the view rotates. Is there a nice solution to this problem (I know that I could create the images to blend into a color and set the background to the same color, but this is not what I would like). A Video of the problem can be seen here:http://tinypic.com/r/2quj24g/6 PS the images are from the OmniGroup GitHub repo and are just used for the demo.

    Read the article

  • Android: Capturing the return of an activity.

    - by Chrispix
    I have a question regarding launching new activities. It boils down to this. I have 3 tabs on a view A) contains gMap activity B) camera activity C) some random text fields. Requirement is that the application runs in Portrait mode. All 3 tabs work as expected w/ the exception of the Camera Preview Surface (B). It is rotated 90 degrees. They only way to make it correct is to set the app to landscape which throws all my tabs around, and is pretty much unworkable. My solution is this : replace my camera activity with a regular activity that is empty w/ the exception of Intent i = new Intent(this,CameraActivity.class); startActivity(i); This launches my CameraActivity. And that works fine. I had to do a linear layout and include 3 images that look like real tabs, so I can try and mimic the operation of the tabs while rotating the screen to landscape and keep the visuals as portrait. The user can click one of the images(buttons) to display the next tab. This is my issue. It should exit my 'camera activity' returning to the 'blank activity' in a tab, where it should be interpreted to click the desiered tab from my image. The main thing is, when it returns, it returns to a blank (black) page under a tab (because it is 'empty'). How can I capture the return event back to the page that called the activity, and then see what action they performed? I can set an onclicklistener where I can respond to the fake tabs (images) being clicked to exit out of the camera activity. On exit, the tab should update so that is where you return. any Suggestions? Thanks,

    Read the article

  • iOS 6 Rotation issue - No rotation from Presented Modal View Controller

    - by hart1994
    I have a MainViewController which has a button which pushes a new view (InfoViewController), via flip horizontailly. like so: controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:controller animated:YES]; The MainView Controller supports Portrait and PortraitUpsideDown. Like so: - (BOOL)shouldAutorotate { return YES; } - (NSUInteger)supportedInterfaceOrientations { return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown); } In my InfoViewController it also states the above code. In my AppDelegate it has this in the LaunchOptions: [self.window setRootViewController:self.mainViewController]; In my app.plist file it supports all orientations. This is because other views need to support landscape as well. So On my MainViewController and InfoViewController I need only Portrait and PortraitUpsideDown. But on another view I need all orintations. My MainViewController works fine, but my InfoViewController is working for all orientations. I am having extreme diffulty trying to get this to work in iOS6. I have researched other posts and tried the assistance other people have provided, but had no luck whatsoever. Please can someone help me acheive this thank you. And I'm a Objective-C newbie :p

    Read the article

  • Stil facing the problem in Orientation in iphone

    - by aman-gupta
    Hi, In my application I have 15 screens in that i m using UIViewController for all screens and in all screens i m using the below way to call other screen :- AppDelegate *appRefre = (AppDelegate *)[[UIApplication sharedApplication]delegate]; [self.navigationController pushViewController:appRefre.frmReferencesLink animated:YES]; And the below code is activated in all screen for orientation to control the user to switch from one orientation to other mode (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if (interfaceOrientation == UIInterfaceOrientationPortrait) { return YES; } else { return NO; } } But when i run my application in iPhone device my application gets terminated when i physically rotate my iphone device from UIInterfaceOrientationPortrait to UIInterfaceOrientationPortraitUpsideDown or UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight. And One more things is that when my application lauch i used following code for launching my appliaction :- 1) I made a pointer in mydelegate.h file: UINavigationController *navigationController; Then synthesize its property @property(nonatomic,retain)UINavigationController *navigationController 2) In mydelegat.m I Wrote @synthesize navigationController; (void)applicationDidFinishLaunching:(UIApplication *)application { navigationController = [[UINavigationController alloc] initWithRootViewController:DefaultViewLink]; [window addSubview:navigationController.view]; [window makeKeyAndVisible]; } 3) In above point DefaultView is launch first and gets remove from view and then actual my appliaction come into picture. So exactly what i want i want my appliaction to be in portrait mode for all screens i dont want my appliaction will switch to other mode.It remains the same as in portrait mode after rotation to any other mode. Please help me out its very urgent. Thanks in Advance and humble request to help me out

    Read the article

  • Windows Phone 7 applications - Orientation Change

    - by Peter Perhác
    Hello there fellow developers! I am working on a Windows Phone 7 app and I can't figure out what I believe is a simple problem for the more seasoned ones. Say I have a layout consisting of two elements: a ListBox (filled with an abundance of items) and a TextBlock (providing the user with some basic instructions). I want these to be one above the other when the device is in Portrait orientation and I want these to be next to each other when the device orientation changes to Landscape. For the Portrait orientation I am using a Grid layout manager, as it lets me define the rows' heights like so... row 0 Height="2*", row 1 Height="*" Listbox sits in row 0, TextBlock in row 1. Now, what would be really neat is to simple change the RowDefinitions into ColumnDefinitions and reassign the listbox/textblock to the grid's columns instead of rows for when the device switches into Landscape. But that's just my idea. I don't know how to get this done elegantly. Maybe there's a better approach to this? Or maybe this is the correct approach and there is some method built for exactly this purpose? Thank you for your suggestions!

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >