Search Results

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

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

  • Having trouble hiding keyboard using invisible button which sits on top of uiscrollview

    - by phil
    I have 3 items in play... 1) UIView sits at the base of the hierarchy and contains the UIScrollview. 2) UIScrollview that is presenting a lengthy user form. 3) An invisible button on the UIScrollview that I'm using to provide "hide the keyboard" features. Notice in the code below that I'm registering to be notified when the keyboard is going to appear and again when it's going to disappear. These are working great. My problem is seemingly one of "layers". See below where I insert the button into the view atIndex:0. This causes the button to be activated and "stuffed" behind the scrollview so that when you click on it, the scrollview grabs the touch and the button is unaware. There is no way to "reach" the button and suppress the keyboard. However, if I insert atIndex:1, the button gets super imposed on top of the text entry fields and so any touch at all is acted upon by the button, which immediately suppresses the keyboard and then disappears. How do I insert the button on top of the UIScrollview but behind the UITextfields that sit there? other logistics: I have a -(void) hidekeyboard function that I have setup with the UIButtion as an IBAction(). And I have the UIButton connected to "files owner" via a ctrl-drag/drop. (Do I need both of those conventions?) This code in ViewDidLoad()... [[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardWillShowNotification object:nil queue:nil usingBlock:^(NSNotification *notification){ [self.view insertSubview:self.keyboardDismissalButton atIndex:0]; }];

    Read the article

  • Scroll view to bottom while keyboard is hiding

    - by Manu
    Hi! I'm using a scroll view to move my view and show certain text fields (that otherwise would be hidden) when the keyboard shows. I basically resize the scroll view to make room for the keyboard, and then scroll up the view smoothly with "scrollRectToVisible", which works perfectly. After that, I can scroll and edit the rest of the text fields without lowering the keyboard, which is what I intend. The problem comes when I want to hide the keyboard again. I have been able to lower the keyboard and scroll down the view to its original position without a problem, but I have been unable to make that transition smooth. At the moment I use the following: - (void)keyboardWillHide: (NSNotification *)notif { CGRect topRect = CGRectMake(0, 0, 1, 1); [scrollview scrollRectToVisible:topRect animated:YES]; scrollview.frame = CGRectMake(0, 0, scrollviewWidth, scrollviewHeight); } I create a CGRect at the top, which I then move into view with "scrollRectToVisible". That works fine and commences the scrolling right when the keyboard is hiding (I use "keyboardWillHide" and not "keyboardDidHide" because the scroll view frame is still missing its lower part). The problem comes when I resize the scroll view frame back to its original dimensions (which I need to do), because then the scrolling is interrupted and the view drops to the bottom suddenly (as there is nothing else to scroll). This causes a glitch, which is why I cannot complete the transition smoothly. Any ideas on how could I lower the keyboard while scrolling the view down smoothly? Should I be scrolling up a bigger view, instead of resizing it? That way I would not have to restore the scroll view frame dimensions when lowering the keyboard, or would I? Thanks very much in advance!

    Read the article

  • iPhone app. Creating a custom UIView that contains UITextField and UIButton.

    - by Dmitry Burchik
    Hi all. I am new to iPhone programming. And I have an issue. I need to create a custom user control that I will add to my UIScrollView dinamically. The control has an UITextField and an UIButton. See the code below: #import <UIKit/UIKit.h> @interface FieldWithValueControl : UIView { UITextField *txtTagName; UIButton *addButton; } @property (nonatomic, readonly) UITextField *txtTagName; @property (nonatomic, readonly) UIButton *addButton; @end #import "FieldWithValueControl.h" #define ITEM_SPACING 10 #define ITEM_HEIGHT 20 #define SWITCHBOX_WIDTH 100 #define SCREEN_WIDTH 320 #define ITEM_FONT_SIZE 14 #define TEXTBOX_WIDTH 150 @implementation FieldWithValueControl @synthesize txtTagName; @synthesize addButton; - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // Initialization code txtTagName = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, TEXTBOX_WIDTH, ITEM_HEIGHT)]; txtTagName.borderStyle = UITextBorderStyleRoundedRect; addButton = [UIButton buttonWithType:UIButtonTypeContactAdd]; [addButton setFrame:CGRectMake(ITEM_SPACING + TEXTBOX_WIDTH, 0, ITEM_HEIGHT, ITEM_HEIGHT)]; [addButton addTarget:self action:@selector(addButtonTouched:) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:txtTagName]; [self addSubview:addButton]; } return self; } - (void)addButtonTouched:sender { UIButton *button = (UIButton*)sender; NSString *title = [button titleLabel].text; } - (void)drawRect:(CGRect)rect { // Drawing code } - (void)dealloc { [txtTagName release]; [addButton release]; [super dealloc]; } @end In my code I create an object of that class and add it to scrollView on form. FieldWithValueControl *newTagControl = (FieldWithValueControl*)[[FieldWithValueControl alloc] initWithFrame:CGRectMake(ITEM_SPACING, currentOffset + ITEM_SPACING, 0, 0)]; [scrollView addSubview:newTagControl]; The control looks fine, but if I click to the textbox or to the button nothing happens. Keyboard doesn't appear, the button is not clickable etc.

    Read the article

  • Issue scrolling table view with content inset

    - by Rog
    Hi all, I am experiencing a weird scrolling issue and I was hoping someone could give me a hand in trying to identify why this is happening. I have included the part of my code that I think is relevant to the question but am happy to update this post with whatever else is needed. I have implemented a pull to refresh view in the tableview's content inset area. The refresh fires an Async NSURLConnection that pulls data from a webserver, parses the relevant information and refreshes the table as required. This is where the refresh process kicks off: - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{ if (scrollView.contentOffset.y <= - 65.0f && !self.reloading) { self.reloading = YES; [self reloadTableViewDataSource]; [refreshHeaderView setState:EGOOPullRefreshLoading]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.2]; self.tableView.contentInset = UIEdgeInsetsMake(60.0f, 0.0f, 0.0f, 0.0f); [UIView commitAnimations]; } } Problem is if I start to scroll whilst the content inset is "visible" (i.e. during reload) I get this weird behaviour where my table sections do not scroll all the way to the top - see screenshot for a clear visual of what I am trying to describe here. I have included a couple of screenshots below that clearly identify what is happening at the moment. Has anyone experienced this before? Any ideas on what I should be looking at to try and fix it? Many thanks in advance, Rog And this is the result if I start scrolling the table. The orange bit at the top of the image is the actual navigation bar, where I would expect the table section (date 1 December 2010) to be.

    Read the article

  • How do I get this linearlayout working on android?

    - by Arkadiy
    I'm trying to create a scrollview that contains a linearlayout with some options inside of it. I'd like for the options to show up at the top and grow downwards, and to have "save," "delete," and "cancel" buttons which show up at the very bottom of the screen (if there is space left in between the bottom of all the options and the top of the buttons). Here's a screenshot of my attempt: http: //img375.imageshack.us/img375/3628/10370572.png (StackOverflow was only letting me post a single link so you'll have to get rid of the space in between http: and the rest) As you can see, the buttons show up directly below the options rather than at the bottom of the screen. In fact the top level (green) linearlayout doesn't even extend all the way down, despite having a height of fill_parent and a weight of 1 (and the blue is the scrollview, so there is room to expand). I've tried every possible combination of heights, weights, gravities, and anything else to get this working and still can't do it. Everytime I pasted my xml layout into here, the top and bottom portions got cut off, so instead I pasted it here: pastey link Can anyone see what I'm doing wrong?

    Read the article

  • UIImageView and UIScrollView load lot of pictures

    - by Allan.Chen
    In my app, i use UIImageView and UIScrollView to show lot of pictures(Every time there are about 20 pictures and every pictures about 600px*500px and size is about 600KB ), i use for this code to do this function. Here is code: //Here is pictures Data; self.klpArry = self.pictureData; CGSize size = self.klpScrollView1.frame.size; for (int i=0; i < [klpArr count]; i++) { UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectMake((size.width * i)+300, 20, 546, 546)]; NSString *filePath = [[NSBundle mainBundle] pathForResource:[klpArr objectAtIndex:i] ofType:@"jpg"]; UIImage *imageData = [[UIImage alloc]initWithData:[NSData dataWithContentsOfFile:filePath]]; [iv setImage:imageData]; iv.backgroundColor = [UIColor grayColor]; [self.klpScrollView1 addSubview:iv]; imageData = nil; iv = nil; iv.image = nil; filePath = nil; [imageData release]; [filePath release]; [iv release]; } // show the picture in scrollview; [self.klpScrollView1 setContentSize:CGSizeMake(size.width * numImage, size.height)]; self.klpScrollView1.pagingEnabled = YES; self.klpScrollView1.showsHorizontalScrollIndicator = NO; self.klpScrollView1.backgroundColor = [UIColor grayColor]; But everytime i init this function, the memory will increase about 5MB, Actually i release UIImageView, UIimage and UIScrollView (vi.image=nil,[vi release]) but i doesn't work, it can't release the memory. BTW, i use my friend code first vi.image=nil then vi=nil; but the pictures not to show on scrollview. any one can help me ?? Thx ~~

    Read the article

  • Loading more than 10 images on iPhone??

    - by SeniorLee
    I'm trying to add more than 10 pictures on ScrollView. NSUInteger i; for (i = 1; i <= numberOfImage; i++) { NSString *imageName = [NSString stringWithFormat:@"d%dimage%d.png", imageSection, i]; UIImage *image = [UIImage imageNamed:imageName]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; // setup each frame to a default height and width, it will be properly placed when we call "updateScrollList" CGRect rect = imageView.frame; rect.size.height = kScrollObjHeight; rect.size.width = kScrollObjWidth; imageView.frame = rect; imageView.tag = i; // tag our images for later use when we place them in serial fashion [scrollView addSubview:imageView]; [imageView release]; } This code is from Apple example and it works fine. But if the variable 'i' is bigger than 10, 'UIImage *image' is empty. The imageName seems to correct. But I don't know why it does not load image. Does anybody sees the problem?? And one more thing. If I do like that, does iOS controls memory automatically? I mean it's kind of wasting memory if all (more than 10) images are loaded on memory even they are not displayed. I've heard that iOS loads images only displayed on screen and free images those are not displayed. Is that right? Thanks for reading.

    Read the article

  • Bug on submitted app binary but not in the simulator - CALayer position contains NaN

    - by Jonathan Thurft
    I submitted my app to the App Store where is ready to download. I've since then received some interesting crash reports when people select an image from the ImagePicker in one of my views. This bug (see below) makes the app crash. I was wondering 2 things. Can anyone spot the problem in the code below? How do you deal with bugs that are only in the App Binary but do not show up when trying to recreate them on the dev environment? - I can make the app crash with the Binary that is on the app store but when I do the same on the simulator or on my test phone the app works perfectly.. The Crash report in BugSense CALayer position contains NaN: [798 nan] Class: CALayerInvalidGeometry 0x00120e99 -[imageCroppingViewController imagePickerController:didFinishPickingMediaWithInfo:] (imageCroppingViewController.m:126) + 163481 The Code - (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; imageView.image = image; CGRect rect; rect.size.width = image.size.width; rect.size.height = image.size.height; imageView.center = scrollView.center; [imageView setFrame:rect]; scrollView.contentSize = imageView.frame.size; self.navigationController.navigationBar.hidden = NO; [myPicker.view removeFromSuperview]; }

    Read the article

  • Level selection view - similiar to Angry Bird's

    - by Piotr
    I am making game and need to prepare view for level selection. Could you recommend me some opensource library which could I use? I need icons to vibrate after long pressing one of them, some callbacks after choosing them, possibility to prepare custom icon's view, page control and horizontal scrolling. I was trying to use OpenSpringBoard but weirdly couldn't see scrollview and pagecontrol working in this project - it seems that there's possibility to use only one page. On the other hand, myLauncher(https://github.com/dlinsin/myLauncher) isn't so easy to include in project, as I need a seperate view with some delegate methods. I need to be compatible with iOS 4.2

    Read the article

  • How do I make the jump from developing for Android to Windows Phone 7?

    - by Rob S.
    I'm planning on making the jump over from developing apps for Android to developing apps for Windows Phone 7 as well. For starters, I figured I would port over my simplest app. The code itself isn't much of a problem as the transition from Java to C# isn't that bad. If anything, this transition is actually easier than I expected. What is troublesome is switching SDKs. I've already compiled some basic Windows Phone 7 apps and ran through some tutorials but I'm still feeling a bit lost. For example, I'm not sure what the equivalent of a ScrollView on Android would be on Windows Phone 7. So does anyone have any advice or any resources they can offer me to help me make this transition? Additionally, any comments on the Windows Phone 7 app market (especially in comparison to the Android market) would also be greatly appreciated. Thank you very much in advance for your time.

    Read the article

  • How do I make the jump from Android to Windows Phone 7?

    - by Rob S.
    I'm planning on making the jump over from developing apps for Android to developing apps for Windows Phone 7 as well. For starters, I figured I would port over my simplest app. The code itself isn't much of a problem. The transition from Java to C# isn't that bad. It's actually easier than I expected. What is troublesome is switching SDKs. I've already compiled some basic Windows Phone 7 apps and ran through some tutorials but I'm still feeling a bit lost. For example, I'm not sure what the equivalent of a ScrollView on Android would be on Windows Phone 7. So does anyone have any advice or any resources they can offer me to help me make this transition? Additionally, any comments on the Windows Phone 7 app market (especially in comparison to the Android market) would be greatly appreciated as well. Thank you very much in advance for your time.

    Read the article

  • Please verify my layout: bottom button keeps coming up over keyboard

    - by steff
    Hi everyone, I have a layout which does almost what I want. There's just one bug regarding the button at the bottom. I should stay at the bottom at all times. But whenever I bring up the soft-keyboard the button will be displayed above the keyboard. This is not what I want but it should become covered by the keyboard. Moreover, I'd be happy if you could comment on how the layout's built. Thanks, steff <?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"> <LinearLayout android:id="@+id/l_layout_tags" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:text="TAGS:" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <AutoCompleteTextView android:id="@+id/actv_tags" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:imeOptions="actionDone" /> <ImageButton android:id="@+id/btn_add_tag" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/ic_input_add" android:onClick="addTag"/> </LinearLayout> <ScrollView android:id="@+id/sv_scroll_contents" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/l_layout_tags" android:scrollbarFadeDuration="2000" > <TableLayout android:id="@+id/t_layout_contents" android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="1" android:paddingRight="5dip"> <TableRow android:id="@+id/tr_template"> <ImageView android:id="@+id/iv_blank" android:src="@android:color/transparent" /> <EditText android:id="@+id/et_content1" android:gravity="top" android:maxWidth="200dp" android:imeOptions="actionDone" /> </TableRow> </TableLayout> </ScrollView> <LinearLayout android:id="@+id/l_layout_media_btns" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_centerHorizontal="true" android:layout_below="@id/sv_scroll_contents" > <ImageButton android:id="@+id/btn_camera" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/ic_menu_camera" android:onClick="takePicture" /> <ImageButton android:id="@+id/btn_video" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/ic_menu_camera" /> <ImageButton android:id="@+id/btn_audio" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/ic_btn_speak_now" /> <ImageButton android:id="@+id/btn_sketch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/ic_menu_edit" /> </LinearLayout> <ImageButton android:id="@+id/btn_save_note" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:src="@android:drawable/ic_menu_upload" /> </RelativeLayout>

    Read the article

  • An offscreen MKMapView behaves differently in 3.2, 4.0

    - by Duane Fields
    In 3.1 I've been using an "offscreen" MKMapView to create map images that I can rotate, crop and so forth before presenting them the user. In 3.2 and 4.0 this technique no longer works quite right. Here's some code that illustrates the problem, followed by my theory. // create map view _mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, MAP_FRAME_SIZE, MAP_FRAME_SIZE)]; _mapView.zoomEnabled = NO; _mapView.scrollEnabled = NO; _mapView.delegate = self; _mapView.mapType = MKMapTypeSatellite; // zoom in to something enough to fill the screen MKCoordinateRegion region; CLLocationCoordinate2D center = {30.267222, -97.763889}; region.center = center; MKCoordinateSpan span = {0.1, 0.1 }; region.span = span; _mapView.region = region; // set scrollview content size to full the imageView _scrollView.contentSize = _imageView.frame.size; // force it to load #ifndef __IPHONE_3_2 // in 3.1 we can render to an offscreen context to force a load UIGraphicsBeginImageContext(_mapView.frame.size); [_mapView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIGraphicsEndImageContext(); #else // in 3.2 and above, the renderInContext trick doesn't work... // this at least causes the map to render, but it's clipped to what appears to be // the viewPort size, plus some padding [self.view addSubview:_mapView]; #endif when the map is done loading, I snap picture of it and stuff it in my scrollview - (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView { NSLog(@"[MapBuilder] mapViewDidFinishLoadingMap"); // render the map to a UIImage UIGraphicsBeginImageContext(mapView.bounds.size); // the first sub layer is just the map, the second is the google layer, this sublayer structure might change of course [[[mapView.layer sublayers] objectAtIndex:0] renderInContext:UIGraphicsGetCurrentContext()]; // we are done with the mapView at this point, we need its ram! _mapView.delegate = nil; [_mapView release]; [_mapView removeFromSuperview]; _mapView = nil; UIImage* mapImage = [UIGraphicsGetImageFromCurrentImageContext() retain]; UIGraphicsEndImageContext(); _imageView.image = mapImage; [mapImage release], mapImage = nil; } The first problem is that in 3.1 rendering to a context would trigger the map to begin loading. This no longer works in 3.2, 4.0. The only thing I have found would trigger the load is to temporarily add the map to the view (i.e. make it visible). The problem being that the map only renders to the visible area of the screen, plus a little padding. The frame/bounds are fine, but it appears to be "helpfully" optimizes the loading to limit the tiles to those visible on the screen or close to it. Any ideas how to force the map to load at full size? Anyone else have this issue?

    Read the article

  • Sharing a UIView between UIViewControllers in a UITabBarController

    - by Wireless Designs
    Hi all - I have a UIScrollView that houses a gallery of images the user can scroll through. This view needs to be visible on each of three separate UIViewControllers that are housed within a UITabBarController. Right now, I have three separate UIScrollView instances in the UITabBarController subclass, and the controller manages keeping the three synchronized (when a user scrolls the one they can see, programmatically scrolling the other two to match, etc.), which is not ideal. I would like to know if there is a way to work with only ONE instance of the UIScrollView, but have it show up only in the UIViewController that the user is currently interacting with. This would completely eliminate all the synchronization code. Here is basically what I have now in the UITabBarController (which is where all this is currently managed): @interface ScrollerTabBarController : UITabBarController { FirstViewController *firstView; SecondViewController *secondView; ThirdViewController *thirdView; UIScrollView *scrollerOne; UIScrollView *scrollerTwo; UIScrollView *scrollerThree; } @property (nonatomic,retain) IBOutlet FirstViewController *firstView; @property (nonatomic,retain) IBOutlet SecondViewController *secondView; @property (nonatomic,retain) IBOutlet ThirdViewController *thirdView; @property (nonatomic,retain) IBOutlet UIScrollView *scrollerOne; @property (nonatomic,retain) IBOutlet UIScrollView *scrollerTwo; @property (nonatomic,retain) IBOutlet UIScrollView *scrollerThree; @end @implementation ScrollerTabBarController - (void)layoutScroller:(UIScrollView *)scroller {} - (void)scrollToMatch:(UIScrollView *)scroller {} - (void)viewDidLoad { [self layoutScroller:scrollerOne]; [self layoutScroller:scrollerTwo]; [self layoutScroller:scrollerThree]; [scrollerOne setDelegate:self]; [scrollerTwo setDelegate:self]; [scrollerThree setDelegate:self]; [firstView setGallery:scrollerOne]; [secondView setGallery:scrollerTwo]; [thirdView setGallery:scrollerThree]; } - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { [self scrollToMatch:scrollView]; } @end The UITabBarController gets notified (as the scroll view's delegate) when the user scrolls one of the instances, and then calls methods like scrollToMatch: to sync up the other two with the user's choice. Is there something that can be done, using a many-to-one relationship on IBOutlet or something like that, to narrow this down to one instance so I'm not having to manage three scroll views? I tried keeping a single instance and moving the pointer from one view to the next using the UITabBarControllerDelegate methods (calling setGallery:nil on the current and setGallery:scrollerOne on the next each time it changed), but the scroller never moved to the other tabs. Thanks in advance!

    Read the article

  • CATiled Layer Question~

    - by Zee
    Hi guys, Was wondering how to apply the CATiled Layer to a webView rather than a scrollView. Went through a lot of books as well as searches and found absolutely nothing regarding how to successfully apply a CATiled Layer to a webView. The basic functionality is to make the website rendering smoother on a webView. I'd really appreciate if someone could provide their insight regarding this. Thanks, -Zee-

    Read the article

  • Android: Scrolling an Imageview

    - by luca
    I have an ImageView that is twice the height of a normale screen ( 960 dip). I would like to scroll it nicely up and down on the screen. The bottom of the screen should contain a bottom. I have tried various combinations of ScrollView and Imageviews without any success. I have also thinkered with the :isScrollContainer attribute without results. Anyone knows how to do this? Cheers, Luca

    Read the article

  • Implement looped movement animation with tap to cancel

    - by Nader
    Hi All; My app is based around a grid and an image that moves within a grid that is contained within a scrollview. I have an imageview that I am animating from one cell to another in time with a slow finger movement and recentering the scrollview. That is rather straight forward. I have also implement the ability to detect a swipe and therefore move the image all the way to the end of the grid and the uiscrollview recentering. I have even implemented the ability to detect a subsequent tap and freeze the swiped movement. The issue with the swipe movement is that the UIScrollView will scroll all the way to the end before the Image reaches the end and so I have to wait for the image to arrive. Also, when I freeze the movement of the image, I have to re-align the image to a cell (which I can do). I have come to the realization that I have to animate the image one cell at a time for swipes and recentering the uiscrollview before moving the image to the next cell. I have attempted to implement this but I cannot come up with a solution that works or works properly. Can anyone suggest how I go about implementing this? Even if you are able to put up code from a different example or sudo code, it would help a lot as I cannot workout how this should be done, should I be using selectors, a listener in delegates, I just simply lack the experience to solve this design pattern. Here is some code: Note that the sprite is an UIImageView - (void)animateViewToPosition:(SpriteView *)sprite Position:(CGPoint)pos Duration:(CFTimeInterval)duration{ CGMutablePathRef traversePath = CGPathCreateMutable(); CGPathMoveToPoint(traversePath, NULL, sprite.center.x, sprite.center.y); CGPathAddLineToPoint(traversePath, NULL, pos.x, pos.y); CAKeyframeAnimation *traverseAnimation = [CAKeyframeAnimation animationWithKeyPath:kAnimatePosition]; traverseAnimation.duration = duration; traverseAnimation.removedOnCompletion = YES; traverseAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; traverseAnimation.delegate = sprite; traverseAnimation.path = traversePath; CGPathRelease(traversePath); [sprite.layer addAnimation:traverseAnimation forKey:kAnimatePosition]; sprite.center = pos; }

    Read the article

  • Implement looped movement animation with tap to cancel

    - by Nader
    Hi All; My app is based around a grid and an image that moves within a grid that is contained within a scrollview. I have an imageview that I am animating from one cell to another in time with a slow finger movement and recentering the scrollview. That is rather straight forward. I have also implement the ability to detect a swipe and therefore move the image all the way to the end of the grid and the uiscrollview recentering. I have even implemented the ability to detect a subsequent tap and freeze the swiped movement. The issue with the swipe movement is that the UIScrollView will scroll all the way to the end before the Image reaches the end and so I have to wait for the image to arrive. Also, when I freeze the movement of the image, I have to re-align the image to a cell (which I can do). I have come to the realization that I have to animate the image one cell at a time for swipes and recentering the uiscrollview before moving the image to the next cell. I have attempted to implement this but I cannot come up with a solution that works or works properly. Can anyone suggest how I go about implementing this? Even if you are able to put up code from a different example or sudo code, it would help a lot as I cannot workout how this should be done, should I be using selectors, a listener in delegates, I just simply lack the experience to solve this design pattern. Here is some code: Note that the sprite is an UIImageView - (void)animateViewToPosition:(SpriteView *)sprite Position:(CGPoint)pos Duration:(CFTimeInterval)duration{ CGMutablePathRef traversePath = CGPathCreateMutable(); CGPathMoveToPoint(traversePath, NULL, sprite.center.x, sprite.center.y); CGPathAddLineToPoint(traversePath, NULL, pos.x, pos.y); CAKeyframeAnimation *traverseAnimation = [CAKeyframeAnimation animationWithKeyPath:kAnimatePosition]; traverseAnimation.duration = duration; traverseAnimation.removedOnCompletion = YES; traverseAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; traverseAnimation.delegate = sprite; traverseAnimation.path = traversePath; CGPathRelease(traversePath); [sprite.layer addAnimation:traverseAnimation forKey:kAnimatePosition]; sprite.center = pos;

    Read the article

  • UITextView inside UIScrollView is not First Responder

    - by Sheehan Alam
    I have a UITextView on a View that becomes the first responder. When I embed the UITextView inside of a UIScrollView in Interface Builder the UITextView is no longer the first responder. I am not sure what has changed? - (void)viewDidLoad { [super viewDidLoad]; [scrollView setContentSize:CGSizeMake(540,620)]; composeTextView.delegate = self; [composeTextView becomeFirstResponder]; }

    Read the article

  • How to make a transparent NSScroller?

    - by aquaibm
    This is my application screenshot.There is only one NSScrollView on the window.I try to make all the scrollview elements transparent,and obviously parts of my code work, but the scroller doesn't. Here is my draw code for custom NSScroller subclass. - (void) drawRect: (NSRect)dirtyRect { [[NSColor clearColor] set]; NSRectFill(dirtyRect); [self drawKnob]; } Does anyone have a clue to make this work? Thanks a lot.

    Read the article

  • Clear content of UIScrollView

    - by Joy
    I have an iPhone application that uses a timer and every time it creates some UILabel and places it onto the UISrollview. What i want is to clear the scroll view every time before it puts UILabel onto the ScrollView. So guys please help me to clear the contents of the UIScrollView. I'm just not been able to do that. Looking for your reply

    Read the article

  • LinearLayout - How to get text to be on the right of an icon?

    - by RED_
    Hi there, Bit of a newbie when it comes to android, only been working on it properly for a few days but even after all the searching I've done im stumped and nobody seems to know how to help me. I have this so far: http://img263.imageshack.us/i/sellscreen.jpg How can I move the text to be besides each icon rather than underneath it? Hoping the gallery won't be moved either. Here is the code i have: <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scroller" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillViewport="true" > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <Gallery xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gallery" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <ImageView android:id="@+id/test_image" android:src="@drawable/icon" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="The offcial UK driving theory test application. Over 190 questions." /> <ImageView android:id="@+id/test_image" android:src="@drawable/icon" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="The offcial UK driving theory test application. Over 190 questions."/> <ImageView android:id="@+id/test_image" android:src="@drawable/icon" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="The offcial UK driving theory test application. Over 190 questions."/> <ImageView android:id="@+id/test_image" android:src="@drawable/icon" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="The offcial UK driving theory test application. Over 190 questions."/> <ImageView android:id="@+id/test_image" android:src="@drawable/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="The offcial UK driving theory test application. Over 190 questions." /> </LinearLayout> </ScrollView> Top half of my code doesn't seem to be showing for some reason but it's just the opening of the linear layout. I will be forever grateful to anyone that can help, i've been racking my brains for days and getting nowhere. Really getting stressed out by it. Thanks in advance!!

    Read the article

  • Debugging a performance issue on ListBoxDragDropTarget (Silverlight Toolkit)?

    - by carlmon
    I have a complex project using SilverLight Toolkit's ListBoxDragDropTarget for drag-drop operations and it is maxing CPU. I tried to reproduce the issue in a small sample project, but then it works fine. The problem persists when I remove our custom styles and all other controls from the page, but the page is hosted in another page's ScrollView. "EnableRedrawRegions" shows that the screen gets redrawn on every frame. My question is this: How can I track down the cause of this constant redrawing?

    Read the article

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