IPhone SDK - Handling horizontal swipes on a UITableView

I have multiple lists in the app.
When the user swipes vertically then i just want to let the UITableView do its default thing which is to scroll the list.
When there is a horizontal swipe then i want to load the next list in the stack (left swipe will load the previous list in the stack and vice-versa).
I would appreciate ideas on how best to approach this problem.
-TRS

The problem with a horizontal swipe in a table view is that is normally reserved for deleting items -- now, not all tables are editable, but still, it's a common gesture and probably not good to overload it.
One quick solution if you have less than 20 pages in the stack, is to stick a UIPageControl below the table, and use it in it's default mode, which rather than swiping is tapping I believe -- see the docs.
But, I might also suggest sticking a separate, small (maybe 64px high -- just enough for a finger) view below your table (size the table to not take up the whole screen if it is) -- in that view you can register for touch events to catch the swipes. Also, at the very bottom of that view, you could embed a UIPageControl for visual feedback of where they are.
You could even dynamically draw (or use images) arrows indicating which direction the user can swipe -- so when on the first view in the stack, you'd only have a right facing arrow -- once they swipe right to left to go to the next stack, draw a right and left arrow.
Just some ideas.
rjf&

Similar Messages

  • IPhone SDK: handling keyboard notifications

    Hi, I need to move UI elements of my view controller when keyboard appears. I do this by registering for the keyboard notifications in my app delegate:
    [[NSNotificationCenter defaultCenter] addObserver:observer selector:@selector(keyboardWasShown:) name:UIKeyboardDidShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:observer
    selector:@selector(keyboardWasHidden:)
    name:UIKeyboardDidHideNotification object:nil];
    and then handling notification as prescribed by Apple (I have similar code for keyboard was shown) to scroll the view up and down:
    - (void)keyboardWasHidden:(NSNotification*)aNotification { CGRect viewFrame = [self.view frame]; viewFrame.origin.y += keyboardSize.height - TOOLBAR_HEIGHT; self.view.frame = viewFrame; }
    So far so good. Now problem description:
    When I execute this code to show OS 3.0 specific message UI:
    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self; [self presentModalViewController:picker animated:YES];
    and when keyboard shows in the actual mail UI, I still get keyboard notification which scrolls my view and therefore breaking my UI (note that mail controller takes entire screen and my view is not even visible at this point).
    I was hoping to temporary disable keyboard notification, so my scrolling code would not get called with this line:
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    But it does not help, keyboard even still get posted.
    What should I do avoid reacting on the keyboard when it created by the message UI?

    leonbrag wrote:
    1. Register my observer and remove my observer in each view's Appear & Disappear notification.
    I don't think there's anything wrong with the above. However, if only one controller has a visible view at any one time, why not just set an instance var (could even be in the app delegate so it's globally visible) so everyone knows which controller's view is visible? I think that would give you the same info as no. 1 above (i.e. all but the visible view's controller could just ignore keyboard notifications).
    In more complicated situations there are a few other approaches. The delegate of any object that owns the keyboard receives two messages directly:
    // Called when the UIKeyboardDidShowNotification is sent.
    - (void)keyboardWasShown:(NSNotification*)aNotification
    // Called when the UIKeyboardDidHideNotification is sent
    - (void)keyboardWasHidden:(NSNotification*)aNotification
    See Listing 5-1 under Moving Content That Is Located Under the Keyboard for details.
    I think you'll also be able to identify the keyboard's owner from the userInfo included with each notification.
    Hope that helps!
    - Ray

  • IPhone SDK - Keyboard overlapps the UITextField

    Hi!
    I've got a problem with the iPhone SDK. I'm creating an UITableView with some UITextFields
    The problem comes when editing the 3d cell with a text area. The keyboard appears over the field in edition mode, so you're not able to see the text you're typing.
    It's quite weird because I have the table with scroll enabled but it doesn't scrolls below the 3d cell (even if I put 10 extra cells)
    any clue on that?

    No, I cannot scroll anything with two fingers (XCode emulator)

  • Problem in set selectedTextcolor in uitableview cell in iPhone SDK 3.1.2

    Hello,
    I set selected text color in uitableview cell using cell.selectedTextColor = [UIColor whiteColor]; for iPhone SDK 2.2.1.
    Now i use iPhone SDK 3.1.2, So for that i make change as per documentation for that i use textLabel properties. But selectedTextColor is not exit.
    So Now for SDK 3.1.2 how to set selectedTextColor?..
    Thank you.

    The textLabel property is an instance of UILabel, so it has its own textColor, textAlignment, and font properties. E.g.:
    cell.textLabel.text = @"foo";
    cell.textLabel.textColor = [UIColor whiteColor];
    cell.textLabel.textAlignment = UITextAlignmentLeft;
    Hope that helps!
    - Ray

  • IPhone SDK 2.2 memory corruption

    Hello. I'm working on an application for iPhone SDK 2.2 and seem to be having weird memory corruption problems. Not necessarily leaks because using Instruments shows my memory stamp never going above about 1.8 megs. The nature of the app is a database of animals so I'm constantly loading and unloading sounds and images. None of the objects are very large (at most I'll have 4 800k pngs loaded at once) and I've checked and rechecked my alloc/retain/release and everything is in order (hence no memory usage increase). However...after using the application for a while I'll notice strange behavior. For example:
    1) we have a UILabel as the title for each page. After a while the font size of this will change.
    2) I have several screens with a subclassed UIScrollView where images are loaded and then added to. The problem shows itself here by the images not showing up. there's no crash, stepping through the debugger shows that the image loads up fine, it's just that the image is not there.
    3) I have a UILabel at the top of an animal description screen, which in the nib file is called "Animal Name" by default. This will change to show "Animal Name" at the top.
    I've removed all audio in our latest build so that isn't the problem. What I'm starting to suspect is that altering anything defined in a nib file will cause corruption. For example, the UIScrollView is defined in the nib file, and I constantly am reassigning the contents of that with a UIImageView. This UIImageView is handled within the subview class like :
    UIImageView *imgView = [[UIImageView alloc] initWithImage: [ UIImage imageWithContentsOfFile:[[NSBundle mainBundle ] pathForResource:imageToLoad ofType:@"png" ]] ];
    imgView.tag = 50;
    [self addSubview:imgView ];
    [ imgView release ];
    Then later when moving away from the screen I'll find that view's tag and remove it from the superview (since addSubView increases the retain count, the alloc+addSubView is cancelled by release+removeFromSuperView)
    I can't explain why titles that are never changed would be affected, but it must somehow be related. What I'm wondering is: are there any known issues involving modification of the contents of objects defined in Nib files? Perhaps the memory allocated when initWithNibName is restrained, then any modification of objects allocated within it can cause corruption. I'm starting to think I should just alloc and free anything modified in code and skip using nib files altogether (I reset the text on buttons for example). If this is a known issue please let me know. I'll give you more information if I can.
    Thank you

    Just download the huge SDK package and install. No need to uninstall the old SDK.

  • How to control the movie player in iPhone SDK 2.0?

    Hello, everybody!
    With the third beta version of iPhone SDK I finally played a movie with the example from the manual. But I need to seek in the movie and control the playing process. With the MPMoviePlayerController class this is impossible, because it has four properties (backgroundColor, contentURL, scalingMode, userCanShowTransportControls) and only three instance methods (initWithContentURL, play, stop). The notifications are two (MPMoviePlayerScalingModeDidChangeNotification, MPMoviePlayerPlaybackDidFinishNotification). How can I know what is the current position of the head and how can I change it? I can't find other classes, which can play a movie. Can somebody help me?
    Stefan

    HeoU wrote:
    Hi Tsvyatkov,
    Do you HAVE [these problems|http://discussions.apple.com/thread.jspa?threadID=1486343&tstart=0] while playing video playback?
    - The keyboard doesn't appear after playing the video (It works great before playing the video)
    - When you play the video, iphone simulator turns in paysage mode. Then when you stop it, it doesn't turn back (SDK beta 3). It worked fine with the SDK beta 1, 2.
    - If you chose a video from a list (UITableView) and you stop the video, then come back to the list, the item is still selected with the blue color.
    thanks
    HeoU
    Yes! I have the same problems! And with the older versions of iPhone SDK I didn't.

  • Do synthesized instance variables work in iPhone SDK?

    I tried using Obj-C properties to synthesize not only the accessor methods, but also the instance variable. I ended up with an error saying something like "...must explicitly name an ivar...".
    I was under the impression the iPhone ran the modern (64-bit) Objective-C runtime. I'm using xCode 3.x and iPhone SDK 2.2. Are synthesized instance variables not supported, or do I need to change some xCode/project configuration settings to activate this support (I'd really like to use it)?
    Does the fact that I'm linking to the Sen Test Kit Framework, or running on a relatively old Intel MacBook Pro cause this problem? If the 2.2 SDK does not support synthesized instance variables, does iPhone SDK 3.0 beta support them?
    Note that I would need the synthesized ivar support to work on the iPhone simulator too (obviously) so that I can do testing. Hopefully the iPhone simulator supports the modern Obj-C 2.0 runtime.
    Thank You,
    Eric

    orangekay wrote:
    A. I don't see that anywhere in the Objective-C 2.0 language specification, so I don't believe this has anything to do with the iPhone SDK.
    B. I don't see any point in adding such a thing to the language as it accomplishes nothing that could not be handled with a standard ivar declaration.
    This sounds like a feature you imagined.
    Yeah, right I imagined it. Get a clue, will you?
    http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/oc Properties.html#//apple_ref/doc/uid/TP30001163-CH17-SW3
    In general the behavior of properties is identical on all runtimes (see Runtime Versions and Platforms in Objective-C 2.0 Runtime Programming Guide). There is one key difference: the modern runtime supports instance variable synthesis whereas the legacy runtime does not.
    For @synthesize to work in the legacy runtime, you must either provide an instance variable with the same name and compatible type of the property or specify another existing instance variable in the @synthesize statement. With the modern runtime, if you do not provide an instance variable, the compiler adds one for you. For example, given the following class declaration and implementation:
    @interface MyClass : NSObject {
    float sameName;
    float otherName;
    @property float sameName;
    @property float differentName;
    @property float noDeclaredIvar;
    @end
    @implementation MyClass
    @synthesize sameName;
    @synthesize differentName=otherName;
    @synthesize noDeclaredIvar;
    @end
    the compiler for the legacy runtime would generate an error at @synthesize noDeclaredIvar; whereas the compiler for the modern runtime would add an instance variable to represent noDeclaredIvar.

  • IPhone SDK - Ideas for pop-up menus

    I have a screen where there are quite a few items which are of the multiple-choice type. In other platforms we use a combo box (pick lists) to do this.
    On the iPhone SDK the only thing that comes close is the UIPickerView which is too heavy IMHO.
    Currently i am using a full screen pop-up with a UITableView inside it for the menu items. It is functional but not cool.
    I guess i could create a view which is rendered as a pop-up and add it as a subview to the parent and make it behave like a pop-up menu.
    Has anyone tried do implement one? I would greatly appreciate your ideas on this.
    Thanks,
    -TRS
    -TRS

    "redstonegirl" <[email protected]> wrote in
    message
    news:eo0dfm$k4r$[email protected]..
    > I'm new to this, and I'm wondering if it is suggested to
    use this drop
    > down for a side menu bar. I am considering doing this
    but my menu must be
    > on the side.
    Yes, once you master the tutorial on creating these type of
    menus, you can
    have them as dropdowns, or flyouts (as they are commonly
    called when
    attached to a vertical menu system).
    Nadia
    Adobe® Community Expert : Dreamweaver
    Tutorials |SEO |Templates
    http://www.DreamweaverResources.com
    http://www.perrelink.com.au
    CSS Tutorials for Dreamweaver
    http://www.adobe.com/devnet/dreamweaver/css.html

  • [iPhone sdk] DOM/create XML support?

    Is there any way to create arbitrary XML on the iPhone other than the low-tech solution of using strings?
    Most environments I've worked in have support for building up a document, i.e.
    document doc = new document(root);
    addElement("myelem1").setText("sometext1");
    addElement("myelem2").setText("sometext2");
    mystring = doc.asXml();
    You get the idea. The underlying API handles all the tag generation, entity replacement, etc. Is this available in the iPhone SDK somewhere?
    Thanks in advance.

    Google has written an almost drop in replacement of NSXMLDocument. I say almost because initWithContentsOfURL is not implemented, nor is -nodesForXPath:error. There may be others that are missing, but it worked for me once I initialized it with an NSString instead of a URL. This replacement is part of the Google Data API. There are only 3 classes that need to be imported out of the whole library. You will also need to add libxml2 to the Frameworks and update your build headers.
    See http://notes.bikemonkey.org/post/47351363/googles-nsxmldocument-replacement-for- iphone
    The XML replacement is only in SVN for the moment, see http://code.google.com/p/gdata-objectivec-client/source/checkout to get it.

  • How to make content horizontal swipe in single standard frame in Indesign CS6?

    How to make content horizontal swipe in single standard frame in Indesign CS6?

    This sounds like a question for the DPS forum. We don't handle DPS questions here:
    Digital Publishing Suite

  • [iPhone SDK] Preference view design/implementation

    Hi, everyone!
    I want to add preference view in my application (build on iPhone SDK 3.0), but don't want to use preference bundle for several reasons.
    And I can't find any suitable UI component to do it (maybe it's UITableView with custom views (with rounded corners)?
    Any thoughts on it?
    Thanks for attention.
    Have a good day

    The rounded corners you see in the system Settings app are produced by a UITableView created with UITableViewStyleGrouped. Each group of cells in a rounded frame is a section of the table view, so you can duplicate a typical Settings page by setting the number of sections and the number of rows per section.
    It looks like you could build most of the cells in Settings by simply adding your own images and/or controls to standard UITableViewCell instances.
    Several of the pages in the UICatalog sample app provide good examples of how to code Grouped style table views with cells similar to some of the Settings cells. That sample code is for 3.0, btw, but almost all of the code is appropriate for 2.x as well.
    If you need help with table views and table view cells in general, see the Table View Programming Guide for iPhone OS.
    For more basic instruction, see Chapter 8 of +Beginning iPhone Development: Exploring the iPhone SDK+ by Mark and LaMarche.

  • IPhone SDK - What is the equivalent of a combo box

    I have a screen where there are quite a few items which are of the multiple-choice type. In other platforms i use a combo box (pick lists) to do this.
    On the iPhone SDK the only thing that comes close is the UIPicketView which is ugly IMHO. it takes too much real estate and too heavy.
    Is this is the only control available now?
    Also does the UIPicker come with an associated control which will launch the picker? What i mean is on other platforms and on the web there is a text field with a button with a down arrow next to it. Clicking either on the text field or the down arrow drops the list down. Is there a similar control on the iPhone which when clicked launches the picker OR do i have to create a button or a custom view which will launch the picker?
    Thanks for reading this and for your feedback.
    -TRS

    I do not believe there is an equivalent of -D in the DB JVM, a possible solution is:
    Load a properties file into the DB using Loadjava, then open this file from your Java code using Properties.load(), then iterate the properties calling System.setProperty().
    Chris

  • After upgrading to iOS 5 my music crash when i turn the iphone vertical to horizontal !!

    after upgrading to iOS 5 my music crash when i turn the iphone vertical to horizontal !!

    I am having this same issue.

  • Learning iPhone SDK - Trying to draw an image

    Although I have programmed for Mac in the last years, I have never used Mac-specific technologies as Cocoa (I have programmed more in OpenGL, SDL, and the like).
    Now I am getting started with the iPhone SDK. I'd like to do some OpenGL|ES stuff, but since it is not supported in the Simulator, and you need to join the Developer Program to test stuff on directly on the device (and admission of new members is closed right now), I am focused on other stuff right now, like using Core Graphics for drawing images on the iPhone.
    My application is based on the Cocoa Touch Application template. I left the default code except for a few changes.
    In file "UntitledAppDelegate.m", I have changed the method applicationDidFinishLaunching to:
    - (void)applicationDidFinishLaunching:(UIApplication *)application {
    window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    contentView = [[[MyView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease];
    [window addSubview:contentView];
    [window makeKeyAndVisible];
    Then, in the MyView interface file (MyView.h), I have added the attribute "UIImageView* image;" to the class, which is declared as a property, and synthesized.
    In the class implementation (MyView.m), I have changed the method initWithFrame to:
    - (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
    self.backgroundColor = [UIColor darkGrayColor];
    image = [self loadImageView:@"box01.png"];
    [self addSubview:image];
    return self;
    loadImageView is a private method I have implemented as:
    - (UIImageView *)loadImageView:(NSString *) imageName {
    UIImage *img = [UIImage imageNamed:imageName];
    UIImageView *theView = [[UIImageView alloc] initWithImage:img];
    return theView;
    Since I have loaded the UIImage, and initialized a UIImageView with it, and the image view is added as a subview of the main view attached to the window, I thought it should be everything needed to draw an image on the screen. But nothing is visible. The screen is simply black when I run this on the Simulator. It doesn't even set the background to dark gray.
    So I need some help with this, I sure that anyone with experience in Mac programming will know how to help me.
    Thank you in advance.
    Message was edited by: Jedive

    I removed the XIB file from the project, but that didn't help. It was a problem with my inexperience with Objective-C. When accessing class properties in a method of the same class, i was not putting "self." before the property (in C++ that's redundant). For example, in the line "window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];". After adding it, it works correctly.

  • IPhone SDK CodeSign Error: Redux (latest OS X update is broken)

    This bug - http://discussions.apple.com/thread.jspa?threadID=1455699&start=0&tstart=0 - is back. My AdHoc project, which worked perfectly last week, has just stopped building, with this:
    "object file format invalid or unsuitable"
    As soon as I upgraded from 10.5.7 to 10.5.8, this bug appeared.
    However, this bug was officially fixed in 10.5.7 - so, I'm guessing here, Apple has accidentally re-created it.
    Unfortunately, I cannot add to the original post, because Apple has frozen the topic.
    So, here's a new topic to ask if anyone else is having this problem, and what they did about it - is it exactly the same as the old bug? or is it different in some way?
    I'm going to try some of the workarounds for the old bug - but hacking command line scripts isn't fun, and I'm worried I might break something even worse .

    iPhone Dev Center
    Downloads
    Read me before downloading
    If you have updated your device to iPhone OS 3.1.3 with iTunes, you must install iPhone SDK 3.1.3 in order to continue with your development.
    *iPhone SDK 3.1.3*
    iPhone SDK 3.1.3 includes the Xcode IDE, iPhone simulator, and a suite of additional tools for developing applications for iPhone and iPod touch.
    _Posted: February 2, 2010_
    Leopard Build: 9M2809a
    Snow Leopard Build: 10M2003a
    *Leopard Downloads*
    iPhone SDK 3.1.3 with Xcode 3.1.4
    iPhone SDK 3.1.3 with Xcode 3.1.4 Readme
    *Snow Leopard Downloads*
    iPhone SDK 3.1.3 with Xcode 3.2.1
    iPhone SDK 3.1.3 with Xcode 3.2.1 Readme
    *Other Downloads*
    iPhone SDK Agreement
    iPhone Configuration Utility

Maybe you are looking for

  • Gaps in data

    Hi.  I am trying to save a lot of data at a high frequency: 36 Analog Channels, 400 samples @ 4kHz per channel, each iteration. I am saving the data inside my loop and this seems to cause a 20ms gap after each pass through.  Is there a way to use the

  • Import/export volume to different administrative server

    Hi everyone, i'm testing the OSB software for DR environments. Now i want to export volume since main administrative server and import volume to different admin server. When I run export command, it shows me "Error: can't execute command - ran out of

  • Master data transport steps

    Hi expert, What will be the steps to transport master data in BI 7? I have transported relevant R/3 data source and then replicated data source in BW. Then I start collecting BW info objects for the master data. When collecting BW info objects for tr

  • About function module

    "FM_SELECTION_CRITERIA_PRINT" What is its use ? There is documentation available in english.

  • I ordered adobe illustrator online yesterday. How am I supposed to get it? Do I download it from some where? Zero direction on this

    I ordered adobe illustrator online yesterday. How am I supposed to get it? Do I download it from some where? Zero direction on this