Search Results

Search found 324 results on 13 pages for 'scrollview'.

Page 6/13 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Formula for producing a CGRect for a UIScrollView, that displays a UIImage in scaled to fit way

    - by RickiG
    Hi I am loading in images with varying sizes and putting them in UIScrollViews, all the images are larger than the UIScrollView. The user can scroll and zoom as they please, but initially I would like for the image to be centered and scaled so the largest side of the image aligns with the edge of the scrollView, i.e. if the picture is in landscape I would like to size and scale it so that the left and right side goes all the way to the edge of the UIScrollVIew and vice versa I found a formula in a utility function in the Programming guide but it does not quite fit my needs. My approach is to use: CGrect initialPos = ? [self.scrollView zoomToRect:initialPos animated:YES]; I know the size of my scrollView and the size of my image, what I need to figure out is the scale and CGRect to apply to the scrollView to center and size my image. Hope someone can help out:) Thanks

    Read the article

  • Drag a UIView from one UIScrollView to another

    - by theDuncs
    I have two UIScrollViews on my screen and I need to be able to drag a UIView from one scrollview to the other. At the moment, I have a UILongGestureRecognizer on the UIView that I want to move, such that when the user starts dragging it, I make the view follow the touch: - (void)dragChild:(UILongPressGestureRecognizer *)longPress { [[longPress view] setCenter:[longPress locationInView:[[longPress view] superview]]]; } But when I get the boundary of the starting UIScrollView, the view disappears because it's locked into that scrollview's bounds. Is there a way to "pop" it out of the scrollview when I start dragging such that I can carry it over to the other scrollview? Also, how do I test for the "drop" location? I want to know if it's been dropped over a certain other view. Or am I going about this all the wrong way? Thanks guys

    Read the article

  • ViewPager resize height to Content

    - by user1324936
    ViewPager does not wrap its height to its content. For my layout I need to set the hight then dynamically because it is nested in other layouts. Therefore I created a ScrollView as content of the ViewPager and check its height in onCreate method of the Fragment, but the ScrollView has always the same size. How can I resize the ViewPager to fit to its content? final ScrollView sv = (ScrollView) v.findViewById(R.id.sv); ViewTreeObserver vto = scrollViewMenuFragen.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { int height = sv.getMeasuredHeight(); //always same height independent of content height //need to resize ViewPager ViewGroup.LayoutParams params = (ViewGroup.LayoutParams) mPager.getLayoutParams(); params.height = height; mPager.setLayoutParams(params); } });

    Read the article

  • How can I reset my UI when the user presses a button?

    - by Fasttracks
    I have 1 scrollview that contain 18 buttons. 1) when a user taps on any button, a button is added to a second UIScrollView. 2) Then, when a user taps on that button on second scrollview the button is removed from second scrollview. both uiscrollviews contain a list of their buttons. Afree both of these steps, I have to reload my scrollview. Can I do the same task by adding observer, so that it will automatically reload when any action done on button, and if yes then how?

    Read the article

  • Optimized Image Loading in a UIScrollView

    - by Michael Gaylord
    I have a UIScrollView that has a set of images loaded side-by-side inside it. You can see an example of my app here: http://www.42restaurants.com. My problem comes in with memory usage. I want to lazy load the images as they are about to appear on the screen and unload images that aren't on screen. As you can see in the code I work out at a minimum which image I need to load and then assign the loading portion to an NSOperation and place it on an NSOperationQueue. Everything works great apart from a jerky scrolling experience. I don't know if anyone has any ideas as to how I can make this even more optimized, so that the loading time of each image is minimized or so that the scrolling is less jerky. - (void)scrollViewDidScroll:(UIScrollView *)scrollView{ [self manageThumbs]; } - (void) manageThumbs{ int centerIndex = [self centerThumbIndex]; if(lastCenterIndex == centerIndex){ return; } if(centerIndex >= totalThumbs){ return; } NSRange unloadRange; NSRange loadRange; int totalChange = lastCenterIndex - centerIndex; if(totalChange > 0){ //scrolling backwards loadRange.length = fabsf(totalChange); loadRange.location = centerIndex - 5; unloadRange.length = fabsf(totalChange); unloadRange.location = centerIndex + 6; }else if(totalChange < 0){ //scrolling forwards unloadRange.length = fabsf(totalChange); unloadRange.location = centerIndex - 6; loadRange.length = fabsf(totalChange); loadRange.location = centerIndex + 5; } [self unloadImages:unloadRange]; [self loadImages:loadRange]; lastCenterIndex = centerIndex; return; } - (void) unloadImages:(NSRange)range{ UIScrollView *scrollView = (UIScrollView *)[[self.view subviews] objectAtIndex:0]; for(int i = 0; i < range.length && range.location + i < [scrollView.subviews count]; i++){ UIView *subview = [scrollView.subviews objectAtIndex:(range.location + i)]; if(subview != nil && [subview isKindOfClass:[ThumbnailView class]]){ ThumbnailView *thumbView = (ThumbnailView *)subview; if(thumbView.loaded){ UnloadImageOperation *unloadOperation = [[UnloadImageOperation alloc] initWithOperableImage:thumbView]; [queue addOperation:unloadOperation]; [unloadOperation release]; } } } } - (void) loadImages:(NSRange)range{ UIScrollView *scrollView = (UIScrollView *)[[self.view subviews] objectAtIndex:0]; for(int i = 0; i < range.length && range.location + i < [scrollView.subviews count]; i++){ UIView *subview = [scrollView.subviews objectAtIndex:(range.location + i)]; if(subview != nil && [subview isKindOfClass:[ThumbnailView class]]){ ThumbnailView *thumbView = (ThumbnailView *)subview; if(!thumbView.loaded){ LoadImageOperation *loadOperation = [[LoadImageOperation alloc] initWithOperableImage:thumbView]; [queue addOperation:loadOperation]; [loadOperation release]; } } } } EDIT: Thanks for the really great responses. Here is my NSOperation code and ThumbnailView code. I tried a couple of things over the weekend but I only managed to improve performance by suspending the operation queue during scrolling and resuming it when scrolling is finished. Here are my code snippets: //In the init method queue = [[NSOperationQueue alloc] init]; [queue setMaxConcurrentOperationCount:4]; //In the thumbnail view the loadImage and unloadImage methods - (void) loadImage{ if(!loaded){ NSString *filename = [NSString stringWithFormat:@"%03d-cover-front", recipe.identifier, recipe.identifier]; NSString *directory = [NSString stringWithFormat:@"RestaurantContent/%03d", recipe.identifier]; NSString *path = [[NSBundle mainBundle] pathForResource:filename ofType:@"png" inDirectory:directory]; UIImage *image = [UIImage imageWithContentsOfFile:path]; imageView = [[ImageView alloc] initWithImage:image andFrame:CGRectMake(0.0f, 0.0f, 176.0f, 262.0f)]; [self addSubview:imageView]; [self sendSubviewToBack:imageView]; [imageView release]; loaded = YES; } } - (void) unloadImage{ if(loaded){ [imageView removeFromSuperview]; imageView = nil; loaded = NO; } } Then my load and unload operations: - (id) initWithOperableImage:(id<OperableImage>) anOperableImage{ self = [super init]; if (self != nil) { self.image = anOperableImage; } return self; } //This is the main method in the load image operation - (void)main { [image loadImage]; } //This is the main method in the unload image operation - (void)main { [image unloadImage]; }

    Read the article

  • UIScrollView Infinite Scrolling

    - by Ben Robinson
    I'm attempting to setup a scrollview with infinite (horizontal) scrolling. Scrolling forward is easy - I have implemented scrollViewDidScroll, and when the contentOffset gets near the end I make the scrollview contentsize bigger and add more data into the space (i'll have to deal with the crippling effect this will have later!) My problem is scrolling back - the plan is to see when I get near the beginning of the scroll view, then when I do make the contentsize bigger, move the existing content along, add the new data to the beginning and then - importantly adjust the contentOffset so the data under the view port stays the same. This works perfectly if I scroll slowly (or enable paging) but if I go fast (not even very fast!) it goes mad! Heres the code: - (void) scrollViewDidScroll:(UIScrollView *)scrollView { float pageNumber = scrollView.contentOffset.x / 320; float pageCount = scrollView.contentSize.width / 320; if (pageNumber > pageCount-4) { //Add 10 new pages to end mainScrollView.contentSize = CGSizeMake(mainScrollView.contentSize.width + 3200, mainScrollView.contentSize.height); //add new data here at (320*pageCount, 0); } //*** the problem is here - I use updatingScrollingContent to make sure its only called once (for accurate testing!) if (pageNumber < 4 && !updatingScrollingContent) { updatingScrollingContent = YES; mainScrollView.contentSize = CGSizeMake(mainScrollView.contentSize.width + 3200, mainScrollView.contentSize.height); mainScrollView.contentOffset = CGPointMake(mainScrollView.contentOffset.x + 3200, 0); for (UIView *view in [mainContainerView subviews]) { view.frame = CGRectMake(view.frame.origin.x+3200, view.frame.origin.y, view.frame.size.width, view.frame.size.height); } //add new data here at (0, 0); } //** MY CHECK! NSLog(@"%f", mainScrollView.contentOffset.x); } As the scrolling happens the log reads: 1286.500000 1285.500000 1284.500000 1283.500000 1282.500000 1281.500000 1280.500000 Then, when pageNumber<4 (we're getting near the beginning): 4479.500000 4479.500000 Great! - but the numbers should continue to go down in the 4,000s but the next log entries read: 1278.000000 1277.000000 1276.500000 1275.500000 etc.... Continiuing from where it left off! Just for the record, if scrolled slowly the log reads: 1294.500000 1290.000000 1284.500000 1280.500000 4476.000000 4476.000000 4473.000000 4470.000000 4467.500000 4464.000000 4460.500000 4457.500000 etc.... Any ideas???? Thanks Ben.

    Read the article

  • How to add a scrollable NSTableView programmatically

    - by Jakob Dam Jensen
    I'm trying to add a tableview to a view in code instead of using Interface Builder and unfortunately it's causing some problems =( Here's an example of how I'm doing it now. NSScrollView *scrollView = [[NSScrollView alloc] initWithFrame:someRect]; NSTableView *tableView = [[NSTableView alloc] initWithFrame: scrollView.bounds]; resultsTableView.dataSource = self; resultsScrollView.documentView = resultsTableView; [someView addSubview: scrollView]; So basically I'm just putting the tableView inside the scrollView (because that's what IB is doing) and then adding the latter as a subview of the someView. The result is that a tableView appears - but the no data is shown within the tableView. Debugging shows that the dataSource is being asked for how many rows are in the tableView but the method: tableView:objectValueForTableColumn:row: is never being called. I suspect that this is because of my way of creating the tableView. I've tried google but no luck and the "Introduction to Table Views Programming Guide" on macdevcenter wasn't helpful either. What am I missing? Thanks in advance...

    Read the article

  • Forwarding first responder to UIScrollView unsuccessful

    - by Winston
    Hello, I am trying to create an image cropping bpx whereby the underlying image can be zoomed an scrolled while the cropping "maskview" layer stays the same and the corners can be dragged in any direction. To achieve this, the ImageView is added to a UIScrollView, and this is added to the SelectionViewController.view . I then add the cropping "maskview" layer to the SelectionViewController.view. I did this instead of adding to the scrollview so that the cropping maskview won't be expanded when the underlying image expands. @interface SelectionViewController : UIViewController <UIScrollViewDelegate> { UIImageView *photoview; // Added to self.scrollview MaskedView *maskedview; // Added to self.view UIScrollView *scrollview; // Added to self.view } The maskview has first responder status and responds accordingly. However, the only event I am interested in the maskview is if any of the corners are dragged (this works fine). The problem I want to try to solve is two-fold: If it is a pinch or zoom gesture, I am trying to forward the responder to the UIScrollview using: [self.nextResponder touchesMoved:touches withEvent:event]; The scrollview does not seem to respond. I have confirmed that the self.nextResponder after the maskedview is the SelectionViewController's view itself. From there, it doesn't seem like the UIScrollview responds. It does respond fine if I remove the cropping maskedview. If I zoom in on the underlying image and the cropping maskview rectangle is still the same, I want to now crop the actual zoomed image. Let's say for the upper left hand corner of the crop box, how can I find what the coordinates translates to in the underlying UIImageView now that the image has been zoomed? Any insight into either of these questions would be appreciated. Thank you, Winston

    Read the article

  • Presenting an image cropping interface

    - by wkw
    I'm trying to engineer a UI for cropping images in iphone OS and suspect I'm going about things the hard way. My goal is pretty much what the Tapbots duo have done with Pastebot. In that app, they dim the source image but provide a movable and resizable cropping view and the image you're cropping is in a zoomable scrollview; when you resize or move the underlying image, the cropping view adjusts appropriately. I mocked up a composite image which will give a sense of the design I'm after, along with how I presently have my view hierarchy setup, viewable here The approach I've started with is the following: UIImageView with the image to crop is in a scrollview, a plain UIView with black fill and suitable transparency/alpha setting is added in front of the imageview. I then use a custom UIView which is a sibling to the scrollview at a higher level, which implements the drawRect: method and for the most part calls CGImageCreateWithImageInRect to get the portion of the image's bitmap that matches the position of the cropping view and draws that to the CGContext. in the viewcontroller I'm using the UIScrollViewDelegate methods to track scrolling and passing those changes to the custom cropping UIView so it stays in sync with the scroll contentOffset. That much is finally working. But trying to keep in sync as the scrollview zoomScale changes is when I figured I should ask for help. Looking for suggestions or guidance. My initial approach just seems like more work than is required. Could this be done with a masking layer in the ImageView? And if so, how would I setup the tracking for moving and resizing the cropping rect? My experience working with layers is non-nil, but very limited thus far.

    Read the article

  • performSelector:withObject:afterDelay: not working from scrollViewDidZoom

    - by oldbeamer
    Hi all, I feel like I should know this but I've been stumped for hours now and I've run out of ideas. The theory is simple, the user manipulates the zoom and positioning in a scrollview using a pinch. If they hold that pinch for a short period of time then the scrollview records the zoom level and content offsets. So I thought I'd start a performSelector:withObject:withDelay on the scrollViewDidZoom delegate method. If it expires then I record the settings. I delete the scheduled call every time scrollViewDidZoom is called and when the pinch gesture finishes. This is what I have: - (void)scrollViewDidZoom:(UIScrollView *)scrollView{ NSLog(@"resetting timer"); [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(positionLock) object:nil]; [self performSelector:@selector(positionLock) withObject:nil afterDelay:0.4]; } -(void)positionLock{ NSLog(@"position locked "); } - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale{ NSLog(@"deleting timer"); [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(positionLock) object:nil]; } This is the output: 2010-05-19 22:43:01.931 resetting timer 2010-05-19 22:43:01.964 resetting timer 2010-05-19 22:43:02.231 resetting timer 2010-05-19 22:43:02.253 resetting timer 2010-05-19 22:43:02.269 resetting timer 2010-05-19 22:43:02.298 resetting timer 2010-05-19 22:43:05.399 deleting timer As you can see the delay between the last and second last events should have been more than enough for the delayed selector call to execute. If I replace performSelector:withObject:withDelay with plain old performSelector: I get this: 2010-05-19 23:08:30.333 resetting timer 2010-05-19 23:08:30.333 position locked 2010-05-19 23:08:30.366 resetting timer 2010-05-19 23:08:30.367 position locked 2010-05-19 23:08:30.688 deleting timer Which isn't what I want but serves to show that it's only the delay that's causing it to not function, not something to do with the selector not being declared in the header, being misspelt or any other reason. Any ideas as to why it's not working?

    Read the article

  • how to find end of scroll value for HorizontalScrollView

    - by DroidCoder
    i need to implement following scenario, here i have two horizontalScrollViews the upper scrollView is a main menu and lower scrollView is a submenu. when i scroll main menu,the menu which comes under center arrow will show its submenu in lower scrollview and from the lower scrollview, the submenu which comes under center arrow shows the screen for that sub-menu. here's my requirement: i've implemented it using HorizontalScrollViews and ViewFlipper and also it works but it will give correct result only when i scroll it slowly and not when scroll fast. i've used onTouch() method with a ACTION_UP event,so when i release finger from screen it will gives me getScrollX() position at that point but here i need getScrollX() position when scroll is finished/stop. here's my code:- @Override public boolean onTouch(View v, MotionEvent event) { switch (v.getId()) { case R.id.mHorizontalScrollViewMain: if (event.getAction() == KeyEvent.ACTION_UP) { Log.d("test", " " + hsvUpperTab.getScrollX() + " , "+ mViewFlipper.getChildCount()); getUpperTabScrolled(hsvUpperTab.getScrollX()); } break; case R.id.mHorizontalScrollViewSub: if (event.getAction() == KeyEvent.ACTION_UP) { Log.d("test1", " " + hsvLowerTab.getScrollX()); getLowerTabScrolled(hsvLowerTab.getScrollX()); } default: break; } return false; }

    Read the article

  • RelativeLayout does not shrink in height

    - by rudas
    Hi, I cannot get my relative layuot view to shrink when using it in the follwing layout, used as a dialog. In below example the scrollview always expands to fill the entire dialog which looks very ugly if there is not much actual content. I have tried most combinations of fill_parent, wrap_content etc without success. The problem seems to be that setting the button to "align_bottom" will cause the dialog to fill its height. But if I change the order and have to button placed below the scrollview the button will not be visible if a lot of content is shown... Please help /Rudas <RelativeLayout android:id="@+id/RelativeLayout01" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="wrap_content"> <ScrollView android:id="@+id/ScrollView01" android:layout_above="@+id/dialogCloseButton" android:layout_alignParentTop="true" android:layout_width="wrap_content" android:layout_height="wrap_content"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/dialogContent" android:orientation="vertical" android:paddingBottom="10dp"> <TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content"> </TextView> </LinearLayout> </ScrollView> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Close" android:id="@+id/dialogCloseButton" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true"></Button> </RelativeLayout>

    Read the article

  • UIScrollView issue with autorotation and content scaling

    - by boliva
    Hi, I'm building a new (autorotating) iPad app that consists mainly of a screen sized UIScrollView that contains an UIImageView for an image which is 5 times the iPad screen resolution while in portrait mode (3840x1024). What I haven't been able to accomplish is that whenever the device rotates (to whichever orientation) the imageView bounds and the scrollView contentSize asjusts the image for the new height (maintaining its aspect ratio), making the height of the image to always fit the device height for the given orientation (so in the particular case of this image, it would get shown as 2880x768). I tried different combinations of autoresizingMask and contentMode for the imageView but the closer I've been able to get is to effectively display the image at the desired size but with a white padding around it and into the scrollView content (to make up for the original orientation contentSize). I also tried recalculating the scrollView contentSize in the didRotate.../viewWillAnimate... rotation-related methods in my viewController class, with no avail. Best regards and thanks for your time

    Read the article

  • contentoffset during flick gesture

    - by Michael Xu
    Hi all, Does anyone else notice that the contentOffset of UIScrollView doesnt update during a flick gesture? It only updates after the flick gesture has totally completed, when the flick gesture is finished. After the finger has left the screen, the scrollview keeps moving, in the decelerating phase. but this isnt reflected in the contentOffset of the UIScrollView. Is there a way to track where the contentOffset is during the decelerating part of the flick gesture? I have an OpenGL layer on top, and i want it to move with the scrollView. Can't seem to get the right info out of the scrollview though... Thoughts? thanks, michael

    Read the article

  • Bitmap in ImageView is cropped off the screen

    - by Computerish
    I'm working on an Android application that needs to download an image and display it inside an image view. The Bitmap is passed to the main java file and added to the image view like this: comic = (ImageView) findViewById(R.id.comic); comic.setImageBitmap(c.getImageBitmap()); This works, except that the left side of the image disappears off the screen. The ImageView is in a ScrollView and the scroll view maintains the correct size. This means that there is black space to the right in the ScrollView and the image is cut off to the left. The XML for the ImageView is this: <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" Any idea why my image is being cut off? Thanks!

    Read the article

  • Remembering state: content offset and table cell reuse.

    - by Attacus
    I have a tableview with cells that have a scrollview in them. The scrollview is paged, 2 pages to be exact, and is meant to be able to quickly compare two small blocks of text. I'm trying to find a way to remember what the content offset of the scrollview is. Cell reuse is killing me. I've tried resetting the offset in prepareForReuse or directly in the cellForRowAtIndexPath, but it seems to give me exactly what you'd expect: Randomly offset tablecells after reuse. Anyone have any ideas?

    Read the article

  • Add subview (rows) fast to UIScrollView while scrolling

    - by tikhop
    I have UIScrollView with a lot of rows (~100) and I implemented dequeueReusableRow method for fast allocating and adding my subviews (rows). Everything work fine, but if I scroll very fast with decelerate some view don't added to scrollView on time only later. - (UIView *)dequeueReusableRow { UIView *view = [reusableRows anyObject]; if(view) { [[view retain] autorelease]; [reusableRows removeObject:view]; }else{ view = [[UIView alloc] init.... } return view; } - (void)addVisibleRows { UIView *row = [self dequeueReusableRow]; row.frame = .... [scrollView addSubview:row] } - (void)scrollViewDidScroll:(UIScrollView *)scrollView { [self addVisibleRows]; [self removeInvisibleRows]; } Please, don't propose me use UITableView because structure of accordion looks like: section - section -- section --- row - section section - row

    Read the article

  • determine if point on screen is within specific UIScrollView subview

    - by Kyle
    A UIScrollView contains several UIView objects; how can I tell if a point on the screen not generated by touches is within a specific subview of the scrollview? so far atempts to determine if the point is in the subview always return the first subview in the subviews array of the parent scrollview, ie the coordinates are relative to the scrollview, not the window. Here's what I tried (edited) -(UIView *)viewVisibleInScrollView { CGPoint point = CGPointMake(512, 384); for (UIView *myView in theScrollView.subviews) { if(CGRectContainsPoint([myView frame], point)) { NSLog(@"In View"); return myView; } } return nil; }

    Read the article

  • Center content of UISCrollView when smaller

    - by hgpc
    I have an UIImageView inside a UIScrollView which I use for zooming and scrolling. If the image/content of the scroll view if bigger than the scroll view everything works fine. However, when the image becomes smaller than the scroll view, it sticks to the top left corner of the scroll view. I would like to keep it centered, like the Photos app. Any ideas or examples about keeping the content of the UIScrollView centered when smaller? I am working with iPhone 3.0. The following code almost works. The image returns to the top left corner if I pinch it after reaching the minimum zoom level. - (void)loadView { [super loadView]; // set up main scroll view imageScrollView = [[UIScrollView alloc] initWithFrame:[[self view] bounds]]; [imageScrollView setBackgroundColor:[UIColor blackColor]]; [imageScrollView setDelegate:self]; [imageScrollView setBouncesZoom:YES]; [[self view] addSubview:imageScrollView]; UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"WeCanDoIt.png"]]; [imageView setTag:ZOOM_VIEW_TAG]; [imageScrollView setContentSize:[imageView frame].size]; [imageScrollView addSubview:imageView]; CGSize imageSize = imageView.image.size; [imageView release]; CGSize maxSize = imageScrollView.frame.size; CGFloat widthRatio = maxSize.width / imageSize.width; CGFloat heightRatio = maxSize.height / imageSize.height; CGFloat initialZoom = (widthRatio heightRatio) ? heightRatio : widthRatio; [imageScrollView setMinimumZoomScale:initialZoom]; [imageScrollView setZoomScale:1]; float topInset = (maxSize.height - imageSize.height) / 2.0; float sideInset = (maxSize.width - imageSize.width) / 2.0; if (topInset < 0.0) topInset = 0.0; if (sideInset < 0.0) sideInset = 0.0; [imageScrollView setContentInset:UIEdgeInsetsMake(topInset, sideInset, -topInset, -sideInset)]; } - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { return [imageScrollView viewWithTag:ZOOM_VIEW_TAG]; } /************************************** NOTE **************************************/ /* The following delegate method works around a known bug in zoomToRect:animated: */ /* In the next release after 3.0 this workaround will no longer be necessary */ /**********************************************************************************/ - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale { [scrollView setZoomScale:scale+0.01 animated:NO]; [scrollView setZoomScale:scale animated:NO]; // END Bug workaround CGSize maxSize = imageScrollView.frame.size; CGSize viewSize = view.frame.size; float topInset = (maxSize.height - viewSize.height) / 2.0; float sideInset = (maxSize.width - viewSize.width) / 2.0; if (topInset < 0.0) topInset = 0.0; if (sideInset < 0.0) sideInset = 0.0; [imageScrollView setContentInset:UIEdgeInsetsMake(topInset, sideInset, -topInset, -sideInset)]; }

    Read the article

  • Become UIScrollViewDelegate delegate for UITableView

    - by Brian
    I have a UITableView instance variable. I want to be able to register my view controller to be the UIScrollViewDelegate for my UITableView controller. I have already tried tableView.delegate = self; But when scrolling, my methods - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate don't get called. Any suggestions?

    Read the article

  • EditText doesn't fill the whole height of the window

    - by user565447
    EditText doesn't fill the whole height of the window. Here is the code: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/LinearLayout01" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> <LinearLayout android:id="@+id/LinearLayout02" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <Button android:id="@+id/bItalic" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button> <Button android:id="@+id/bBold" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:id="@+id/bUnderline" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:id="@+id/bStrike" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="S" /> <Button android:id="@+id/bSub" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:id="@+id/bSup" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <ImageButton android:id="@+id/bInsertImage" android:src="@drawable/insertimage" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <ImageButton android:id="@+id/bInsertTable" android:src="@drawable/table" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> <FrameLayout android:id="@+id/FrameLayout02" android:layout_height="fill_parent" android:layout_width="fill_parent" > <TabHost android:id="@+id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingTop="62px"> <ScrollView android:id="@+id/scroll01" android:layout_width="fill_parent" android:layout_height="fill_parent"> <HorizontalScrollView android:id="@+id/scroll_hor01" android:layout_width="fill_parent" android:layout_height="fill_parent"> <EditText android:id="@+id/VisualPane" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </HorizontalScrollView> </ScrollView> <ScrollView android:id="@+id/scroll02" android:layout_width="fill_parent" android:layout_height="fill_parent"> <HorizontalScrollView android:id="@+id/scroll_hor02" android:layout_width="fill_parent" android:layout_height="fill_parent"> <EditText android:id="@+id/HTMLPane" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </HorizontalScrollView> </ScrollView> </FrameLayout> </TabHost> </FrameLayout> </LinearLayout> Here is a screenshot: Why doesn't EditText fill the whole height of the window?

    Read the article

  • UIScrollView map with pins that stay at a fixed size?

    - by OMH
    Hi, In my app, I have a ScrollView that shows a map(just a jpeg). On top of the ScrollView, I added some pins(UIImageView) So far so good. But when I zoom in, the pins also get larger. I would like the pins to stay at a fixed size, just like the pins on the google map application on the iPhone. How do I solve this? Thanks!

    Read the article

  • UIScrollview disable transparency

    - by Frank
    It seems that UIScrollview has a transparency set by default. I have a background image set as a subview in self.view. but the image is showing on my scrollview that's also on the subview layer. I want it to cover up the background image so the scrollview transparency is disable.

    Read the article

  • Autoresize UITextView and UIScrollView

    - by dennis3484
    Hello guys, I already did several searches on Stack Overflow and Google, but I couldn't find a solution to my problem. I have a Detail View for a product that includes a UIScrollView and a few subviews (UIImageView, UILabel, UITextView). You can find an example here. First I wanna autoresize the UITextView (not the text itself!) to the corresponding height. Then I wanna autoresize the entire UIScrollView so that it fits the height of my UITextView and the elements above it. I've tried the following code: myUITextView.frame = CGRectMake(2.0, 98.0, 316.0, self.view.bounds.size.height); [scrollView setContentOffset:CGPointMake(0.0, 0.0) animated:NO]; scrollView.contentSize = CGSizeMake(320.0, 98.0 + [myUITextView frame].size.height); [self.view addSubview:scrollView]; 98.0 + [myUITextView frame].size.height) because my thought was: After getting the height of myUITextView, add the height of the other subviews (98.0) to it. Unfortunately it doesn't work very well. Depending on the content of the UIScrollView, it is too short or too long. I did some logging with the result that the height of the UITextView is always the same: 2010-01-27 14:15:45.096 myApp[1362:207] [myUITextView frame].size.height: 367.000000 Thanks!

    Read the article

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