Circular Scroll View

Hi all,
I am trying to implement a circular scroll view.
I have added the scroll views and 3 uiview's to the scroll view as the subview.
It is working fine, but after sometimes the scroll view's delegates are not getting called.
// MyScrollViewViewController.h
// MyScrollView
// Created by Biranchi on 26/05/09.
// Copyright PurpleTalk 2009. All rights reserved.
#import <UIKit/UIKit.h>
@interface MyScrollViewViewController : UIViewController <UIScrollViewDelegate> {
IBOutlet UIScrollView *scrollView;
IBOutlet UIView *view1;
IBOutlet UIView *view2;
IBOutlet UIView *view3;
IBOutlet UILabel *label1;
IBOutlet UILabel *label2;
IBOutlet UILabel *label3;
int viewAtIndex;
int currentOffset;
int firstOffset, lastOffset;
int currentContentInset;
int tempOffset;
NSMutableArray *arr;
@end
// MyScrollViewViewController.m
// MyScrollView
// Created by Biranchi on 26/05/09.
// Copyright PurpleTalk 2009. All rights reserved.
#import "MyScrollViewViewController.h"
@implementation MyScrollViewViewController
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
// Custom initialization
return self;
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
//static int j = 0;
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
arr = [[NSMutableArray alloc] init];
[arr addObject:view1];
[arr addObject:view2];
[arr addObject:view3];
//NSLog(@"arr : %@", arr);
scrollView.minimumZoomScale = 1.0f;
scrollView.maximumZoomScale = 2.0f;
scrollView.delegate = self;
//scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
firstOffset = 0;
currentOffset = 320;
lastOffset = 640;
currentContentInset = 320;
CGRect frame;
//Scroll View
frame = [view1 frame];
[view1 setBackgroundColor:[UIColor redColor]];
frame.origin.x = 0;
[view1 setFrame:frame];
frame = [view2 frame];
[view2 setBackgroundColor:[UIColor greenColor]];
frame.origin.x = 320;
[view2 setFrame:frame];
frame = [view3 frame];
[view3 setBackgroundColor:[UIColor blueColor]];
frame.origin.x = 640;
[view3 setFrame:frame];
[scrollView addSubview:view1];
[scrollView addSubview:view2];
[scrollView addSubview:view3];
[scrollView setContentSize:CGSizeMake(3*320, 480)];
[scrollView setContentOffset: CGPointMake(currentOffset,0) animated:NO];
[self.view addSubview:scrollView];
//NSLog(@"Self.view Subviews : %@", [self.view subviews]);
#pragma mark -
#pragma mark ScrollView Delegate
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView1
NSLog(@"Will begin dragging ===");
CGPoint offset = [scrollView1 contentOffset];
tempOffset = offset.x;
NSLog(@"Offset : %@", NSStringFromCGPoint(offset));
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView1
NSLog(@"ScrollView did end decelerating ");
int i, result;
CGPoint offset = [scrollView1 contentOffset];
currentOffset = offset.x;
NSLog(@"Offset : %@", NSStringFromCGPoint(offset));
if( ( (currentOffset - tempOffset) > 0 ) || ( (currentOffset == tempOffset) && (currentOffset == lastOffset) ) )
NSLog(@"Show next page , current : %d, temp : %d", currentOffset, tempOffset);
for(i=0; i<[arr count]; i++)
if( [[arr objectAtIndex:i] frame].origin.x == currentOffset )
NSLog(@"Current view on screen : %d", i);
break;
NSLog(@"Before Current offset : %d, last offset : %d", currentOffset, lastOffset);
if( currentOffset == lastOffset )
result = i-2;
if(result < 0)
result += 3;
NSLog(@"Change the frame of object at index : %d", result);
[[arr objectAtIndex:result] setFrame:CGRectMake(currentOffset + 320, 0, 320, 480)];
[scrollView1 setContentSize:CGSizeMake(currentOffset+640,480) ];
lastOffset += 320;
firstOffset += 320;
NSLog(@"Current offset : %d, first offset : %d , last offset : %d", currentOffset, firstOffset, lastOffset);
else if( ( (currentOffset - tempOffset) < 0 ) || ( (currentOffset == tempOffset) && (currentOffset == firstOffset) ) )
//NSLog(@"Show prev page");
for(i=0; i<[arr count]; i++)
if( [[arr objectAtIndex:i] frame].origin.x == currentOffset )
NSLog(@"==Current view on screen : %d", i);
break;
NSLog(@"==Before Current offset : %d, First offset : %d", currentOffset, firstOffset);
if( currentOffset == firstOffset )
result = i+2;
if(result >= 3)
result -= 3;
NSLog(@"==Change the frame of object at index : %d", result);
[[arr objectAtIndex:result] setFrame:CGRectMake(currentOffset - 320, 0, 320, 480)];
UIEdgeInsets contentInset = {0,currentContentInset,0,0};
[scrollView1 setContentInset:contentInset ];
firstOffset -= 320;
currentContentInset += 320;
lastOffset -= 320;
NSLog(@"==Current offset : %d, first offset : %d, Last Offset : %d", currentOffset, firstOffset, lastOffset);
else
NSLog(@"Error in offset");
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView1
return [[scrollView1 subviews] objectAtIndex:viewAtIndex];
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView1 withView:(UIView *)view atScale:(float)scale
//NSLog(@"View Zoomed : %@, scale : %f", view, scale);
#pragma mark -
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceO rientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
- (void)dealloc {
[super dealloc];
@end
What is the problem?
Thanks for your help in advance...

This problem is solved.

Similar Messages

  • Disabled scroll view scrolling becomes enabled when keyboard is up

    I have a scroll view for which I have disabled horizontal scrolling. Normally this works fine. However, I have recently added functionality to make the view scroll when the keyboard is up so that text fields, etc. are not occluded by the keyboard. When the keyboard is up, I am suddenly able to scroll the view horizontally, even though I am not explicitly enabling horizontal scrolling in the scroll view at any point.
    I have checked, and I am not setting the size of the scroll view's frame at any point in code, and the only place in I am setting the scroll view's contentSize property, I am setting it to the size of the existing scroll view (320). If anybody has come across this problem before, or has any suggestions for other things I could check then I'd be very grateful.

    I think this was happening because I was trying to set the content view size in IB using the content size, but this was actually changing the content inset, rather than the content size which appears to have to be set programmatically. Oddly, changing the inset allows the view to scroll, it just causes problems when the content view is scrolled.

  • Is a scrolling view available in the ical month view?

    Is it possible to view a month begining in the current week and not from the first week of the month? In Now Up to Date this is called a "scrolling view." If this is possible in ical how do I do it? Thanks for the help. JEBNY

    Hi JEBNY,
    Not in iCal 2. You could send some feedback to Apple and perhaps they may consider it for future versions.
    Best wishes
    John M

  • How to solve the flash Builder 4.6 scroll view and textinput  display problem?

    I have a dynamic form application which worked well on flash builder 4.5, having display problems in flash builder 4.6 now. What I did is adding
    TextInput objects  to a scroll view and set the texts for them dynamically. Everything is fine after the screen loaded. But if I scroll down, sometimes the texts will be placed in wrong positions. I attached the screen copy of the wrong display. Does anybody know how to solve this problem? Thanks.

    Check out the two threads below (if you have not already). I have not tried it but aeonus describes an approach that made me think of something that might work ... It is a workaround but, what if you have a text field (txtA) with the skin that does not allow soft keyboard selection, but does scroll correctly, and on the onClick event of that text field, you dynamically cover it with another text field (txtB) that does allow soft keyboard selection, (but does not scroll properly) and trigger the keyboard. After you get the entry from the user, set the value of txtA and destroy txtB ... leaving you (theoretically) with properly scrolling text fields. If you have a lot of those in your app, you might want to write a component that implements that behavior.
    "Create a dynamic textfield, and on click, invoke create a StageText instance at the same location as the textfield (by setting the StageText.viewPort property)
    Finally, set StageText.softKeyboardType to "numeric" and call StageText.assignFocus();"
    http://forums.adobe.com/thread/915019?tstart=0
    http://forums.adobe.com/thread/911214?tstart=0

  • Editing scroll view frame size in IB causes table view to change

    I suppose this is a continuation of the problems I was having with the table view resizing: http://discussions.apple.com/thread.jspa?threadID=2618816&tstart=0.
    I have a controller which needs to have a scroll view with numerous elements attached to it, including a table view.
    I have performed the following steps:
    - Set the simulated interface elements of the owning view to a nav bar.
    - Added a scroll view to the main view in the nib file.
    - Set the file owner view controller subclass' view to the scroll view.
    - Set the contentSize of the scroll view to the desired size in viewDidLoad.
    The problem is that the table view size/position are incorrect when I load the view in the iPhone simulator if I change the scroll view's frame size from 320x460. Basically, every time the scroll view frame size is changed, it causes the scroll view position and size to change.
    However, there are times I want to make the scroll view's frame size bigger in order to edit items that might be offscreen when the application is first loaded, which becomes awkward if the size of the view in IB or in code without causing the table view size/position to change. I keep having to change the size of the scroll view frame, edit the items, change it back to 320x460, and then fix the table view.
    Is there a way around this, such as a way to locking the size of a table?

    Hi Kaspars,
    I would say there is atm no possibility to change the table view size dynamicly, because you can't input a formula into the size field so the size is fixed as you enter it.
    Best Regards,
    Marcel

  • Problem with the table view's _visibleBounds when used on a scroll view

    I've had numerous problems with getting a table view to work on a scroll view since the table view keeps resizing (http://discussions.apple.com/thread.jspa?threadID=2618816&tstart=0)
    I have created the views in IB. The scroll view is attached to the controller's view, and is assigned as the controller's view. The frame size of the scroll view is 320x436. I am manually setting the content size in code:
    UIScrollView* tempScrollView = (UIScrollView*) self.view;
    tempScrollView.contentSize = CGSizeMake(320, 720);
    The table view's frame's width/height is set to 280x88 in IB (i.e the size of two cells), and the header and footer are set to size 0.
    However, when I run the code, the table view is smaller, it is only 280x68. I have looked in the debugger, and the table view's _contentSize (of its scroll view) is 280x88; however, the _visibleBounds property is 280x68.
    I've tried looking into the documentation for the UITableView class, but can't find anything on the _visibleBounds property, or where it is being set and how to force it to the correct size.
    If anybody has any advice, I'd appreciate it.

    I can get around this problem by going to the scrollview which the tableview belongs to, and unchecking the Autoresize Subviews box.
    But if anybody knows about the _visibleBounds property, or the rules which are applied when resizing subviews, I'd be interested.

  • Issue with scroll viewer using itemswrapgrid in gridview?

    Hi,
    am developing a windows phone 8.1 app using C# and xaml.
    i need to wrap my gridviewitems vertically.
    I have 10 GridView items in my GridView am using the below code to wrap my gridview items,
    but am able to see only 6 items, the scrollviewer is not coming vertically even though there are some more items.
    (In the below code for reference i just added only one grid view item but i have 10 gridview items in my code ,
    for every gridview item the height and width are 175 and 175 respectively)
    <Page.Resources>
            <ItemsPanelTemplate x:Key="GridViewItemsPanel">
                <ItemsWrapGrid Orientation="Vertical" />
            </ItemsPanelTemplate>
        </Page.Resources>
     <GridView x:Name="landscapeGridview"  
                    HorizontalContentAlignment="Stretch"
                      HorizontalAlignment="Stretch"
                      VerticalAlignment="Stretch"
                      ItemClick="GridView_ItemClick"
                      IsItemClickEnabled="True" 
                      ItemsPanel="{StaticResource GridViewItemsPanel}"
                     ScrollViewer.HorizontalScrollMode="Disabled"
                     ScrollViewer.VerticalScrollMode="Enabled"
                     ScrollViewer.HorizontalScrollBarVisibility="Visible"
                     ScrollViewer.VerticalScrollBarVisibility="Auto"
                      Grid.Row="2" Padding="10,0,0,0">   
    <GridViewItem Height="175" Width="175" Margin="0,5,5,0">
                            <Border Height="165" Width="165"
                        Tag="Notes" Background="#DDECEF">
                                <Grid>
                                    <Image Source="Assets/.png" Margin="0,0,0,0"></Image>
                                    <Image Source="Assets/.png" Margin="0,20,20,0" HorizontalAlignment="Right"
                                       VerticalAlignment="Top" Height="40" Visibility="Collapsed"></Image>
                                    <StackPanel    Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}"  
                                                     VerticalAlignment="Bottom" Margin="0,0,0,0" Height="30"
    Orientation="Horizontal"
                                               >
                                        <TextBlock Text="" FontSize="20"
                                 Margin="50,0,0,0"
                                   HorizontalAlignment="Center" 
                                            RequestedTheme="Dark"
                                   ></TextBlock>
                                        <TextBlock x:Name="notescounttxtblk" VerticalAlignment="Center" Margin="30,0,0,10"
                                          FontSize="20"></TextBlock>
                                    </StackPanel>
                                </Grid>
                            </Border>
                        </GridViewItem>
    </GridView>
    How to get the scroll viewer to view all the items vertically?
    Any help please?

    Hi Santhosh,
    Per my understanding, this issue is related to container definition where you put your GridView control. In this case, it is the Grid container.
    First you can see a working sample,
    https://code.msdn.microsoft.com/windowsapps/ListViewSimple-d5fc27dd. See the scenario 1 in windows phone project, I can reproduce your issue by setting the height of RowDefinition to “auto” where the GridView control sitting in. You need to check the height
    and width property of the layout. See more information about layout in XAML.
    https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh465337.aspx.
    You’ve not mentioned the definition of the Grid layout, I assume you need change the RowDefinition. If you don’t know how, please see details in above code sample.
    Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to use scroll view?

    Having some problems when attempting to create a 'scroll view' widget for iBooks Author in iAd Producer. Basically I have a historical document that I want readers of the book to be able to examine closely and scroll around on through their ipad.
    I believe I have followed all the steps within iAd Producer and when I select the preview button within the program, it appears to work fine. When I export the widget and place it within my ibook, however, a portion of the document image appears but no scroll function is possible.
    Anyone else faced this problem or have any advice?

    Hi niaker!
    I'm also using a scrollview object in my iBA in iAd Producer project and everything works fine also in the device.
    However, I try to hide the vertical scroll indicator with:
    myscroll.setShowsVerticalScrollIndicator(false);
    In the iAd and in the iBooks desktop version, the indicator is still showed, but in the device it is hidden. So, it seems it's a different behavior depending on the device...
    Cheers,

  • How to make Scroll viewer zoom disable

    how to make Scroll viewer zoom disable in windows store app

    Hi Imtiyazk,
    Thanks for sharing the solution, should help others have the same issue.
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Paginated scroll view

    Has flex mobile a component to implement a paginated scroll view?
    I mean a view which I can scroll left/right and stops to each page, plus the usual dots at the bottom to indicate the current page.
    Much like ViewPager for android.

    Paging support is coming to List/Scroller in Flex 4.6: http://opensource.adobe.com/wiki/display/flexsdk/Item+Snapping
    However it does not include a page indicator by default so you will have to hook one up.

  • Scroll View Not Working?

    Hi,
    Im just making an App that has a few scrolling pages in it. But i haven't done UIScrollView's for a while (at least 1 or 2 SDK's ago). When i go and put a scroll view into my page in IB it USED TO just work right away in my project right off the bat, no editing needed everything just went up and down as it should, but now nothing happens, and i mean NOTHING, nothing moves if i touch it. Do we need to programme these now or what? Or am i doing something (or not doing something) wrong?
    I mean i have no code for it, i thought they just worked? Like a scrolling text view?! So whats going on?
    Thanks for any help guys!

    Hey Mark -
    Take a look at viewDidLoad in one of your controllers from 1 or 2 SDK's ago. Is there a line like this?:
    self.view.contentSize = contentView.frame.size;
    In the above, the UIScrollView object is connected to the 'view' outlet of the controller, and contentView is an IBOutlet connected to the UIView object you wish to scroll. I.e. the contentView has been added as a subview of the scroll view, and that subview contains all the features of this controller's screen.
    - Ray

  • Restoring iPhone app state with a stack of view controllers+scroll view

    The state of my native iPhone app usually has a stack of view controllers and a scroll view in the current view controller. When I restore the state of the app (for example, if the user has exited and comes back), I'd like to restore the stack of controllers and scroll to the appropriate page WITHOUT the user seeing all the view controllers getting pushed onto the stack and the scrolling involved to get to the appropriate page. Does anyone have some quick and dirty code that does this?
    thanks in advance, Chuck

    Looks like the scrolling will be done BEFORE the view appears if you follow the basic (or some variation of) "-(void) restore" paradigm as outlined in DrillDownSave.
    Thanks again, Rick--I did look at the sample code examples first, but got confused between the versions of DrillDown*
    Chuck

  • What is the flip or scroll view i have seen on firefox

    when a image search comes up, the images are all in a row and flip or scroll left to right, al on a black back ground

    Where does that happen?
    The site may be using a lightbox or similar script to achieve this.
    *http://en.wikipedia.org/wiki/Lightbox_%28JavaScript%29

  • Why are routine processes (mouse scrolling, viewing videos, appearance of typed text) filled with pauses? I've disabled or uninstalled most of my plug-ins, and don't encounter this problem with other browsers.

    My problem is unique to the Firefox browser, and does not occur with Opera or IE.
    Way too often (about once a minute or so), Firefox will suffer a brief pause in performing functions, even simple ones.
    It is impossible for me to watch any video in Firefox without the picture pausing periodically. Oftentimes, text I type suffers a delay before appearing in a web form. Mouse scrolling is not very dependable at all.
    I have disabled or uninstalled most of my plug-ins and add-ons, yet the problem still persists. I have attempted to streamline to only the most necessary plug-ins, but to no avail.
    I love Firefox, but I don't like the choppy videos or downgrading of my productivity these problems are causing.

    My problem is unique to the Firefox browser, and does not occur with Opera or IE.
    Way too often (about once a minute or so), Firefox will suffer a brief pause in performing functions, even simple ones.
    It is impossible for me to watch any video in Firefox without the picture pausing periodically. Oftentimes, text I type suffers a delay before appearing in a web form. Mouse scrolling is not very dependable at all.
    I have disabled or uninstalled most of my plug-ins and add-ons, yet the problem still persists. I have attempted to streamline to only the most necessary plug-ins, but to no avail.
    I love Firefox, but I don't like the choppy videos or downgrading of my productivity these problems are causing.

  • How to get Zoom value in scroll viewer in C# wpf Kinect SDK 2.0?

    I have recently started using the Kinect SDK 2.0 and am focusing on a zoom and pan functionality, as in the Control Basics-WPF sample.
    I have got the zoom and pan functionality up and running. The problem is that I wish to access the value of the amount of zoom which has been performed by the Pinch zoom gesture.
    Here is my xaml:
        <UserControl x:Class="ImageNav.NavigationImage"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
              xmlns:k="http://schemas.microsoft.com/kinect/2014"
              mc:Ignorable="d"
              d:DesignWidth="1200"
              d:DesignHeight="700"
              >
            <Grid Grid.RowSpan="2">
                <ScrollViewer Name="scrollViewer" Grid.Row="0"
                              HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
                              k:KinectRegion.IsHorizontalRailEnabled="true" k:KinectRegion.IsVerticalRailEnabled="true"
                              k:KinectRegion.ZoomMode="Enabled">
                    <Image Name="navigationImage" RenderTransformOrigin="0.5, 0.5" />
                </ScrollViewer>
                <TextBox x:Name="ZoomTextBox" Grid.Row="1" TextWrapping="Wrap" Text="Zoom: 100%" IsEnabled="False" Panel.ZIndex="10" BorderThickness="0"
    HorizontalAlignment="Right" VerticalAlignment="Bottom" FontSize="20"/>
            </Grid>
        </UserControl>
    I would have wanted there to be something like `k:KinectRegion.ZoomFactor`, but that isnt available. I've also tried to see what changes in the UI elements when I perform the zoom gesture, by writing the `Height` and `ActualHeight` properties of the `ScrollViewer
    scrollViewer` and `Image navigationImage` to a log file, but they show no change whatsoever.
    When I perform the zoom gesture, I would like to get the value of zoom i.e. the current height and width of the image with respect to the original height and width.

    You might want to look deeper into how the scrollviewer works in WPF. I don't know the specifics but I am sure it doesn't change the physical size of the image, but modifies it's rendering properties of the ScrollViewer transform(zoom == scale). You can
    probably subscribe to an event whenever there is a change detected.
    Carmine Sirignano - MSFT

Maybe you are looking for