Search Results

Search found 800 results on 32 pages for 'tap'.

Page 25/32 | < Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >

  • How can I generate filesystem images that are usable on many different virtualization systems?

    - by Mark Longair
    I have written a script that generates a root filesystem image (based on Debian lenny) suitable for User-Mode Linux. (Essentially this script creates a filesystem image, mounts it with a loop device, uses debootstrap to create a lenny install, sets up a static IP for TUN/TAP networking, adds public keys for login by SSH and installs a web application.) These filesystem images work pretty well with UML, but it would be nice to be able to generate similar images that people can use on alternative virtualization software, and I'm not familiar with these options at all. In particular, since the idea is to use this image as a standalone server for testing the web application, it's important that the networking works. I wonder if anyone can suggest what would be involved in customizing such root filesystem images such that they could be used with other virtualization software, such as VMware, Xen or as an Amazon EC2 instance? Two particular concerns are: If such systems don't use a raw filesystem image (e.g. they need headers with metadata or are compressed in some particular way) do there exist tools to convert between the different formats? I assume that in the filesystem, at least /etc/network/interfaces will have to be customized, but are more involved changes likely to be necessary? Many thanks for any suggestions...

    Read the article

  • How to delete row in TTTableViewController (Three20)

    - by Dmitry
    Hi, The Three20 is great library. It's making the work with tables very easy. But one gap that I noticed - is deletion of rows, with animation. I spent many hours trying to do this, and this is what I'm doing: // get current index patch UITableView* table = [super tableView]; NSIndexPath *indexPath = [table indexPathForSelectedRow]; //delete row in data source TTListDataSource * source = (TTListDataSource *)self.dataSource; [source.items removeObjectAtIndex:indexPath.row]; // delete row from the table, with animation [table deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; After this code runs the error appears: [NSCFArray objectAtIndex:]: index (0) beyond bounds (0) I'm using the class inherited from the TTTableViewController. And I doesn't implement the DataSourceDelegate or TableViewDelegate because I'm using the Three20 as much as possible. So, this is how I create datasource: for(NSDictionary *album in (NSArray *)albums){ TTTableRightImageItem *item = [TTTableRightImageItem itemWithText:@"name" imageURL:@"image url" defaultImage:nil imageStyle:TTSTYLE(rounded) URL:@"url of selector where I actually catch the tap on a row"]; [tableItems addObject:item]; } self.dataSource = [TTListDataSource dataSourceWithItems:tableItems]; I read this article (article) but it doesn't help :( So, I know that this is very simple for gurus from this site. Can you just give me advanced sample of how to do this Thanks

    Read the article

  • UISearchBar and UINavigationItem

    - by tbehunin
    I can't seem to get a UISearchBar to position itself from the far left to the far right in the navigation bar. In the -(void)viewDidLoad method, I have the following code: `UISearchBar *sb = [[UISearchBar alloc] initWithFrame:self.tableView.tableHeaderView.frame]; sb.delegate = self; self.navigationItem.titleView = sb; [sb sizeToFit]; [sb release];` When you build and run, it looks just fine at first glance. However, looking more closely, you can tell there is a margin/space on the left. This wouldn't be a big deal in the grand scheme of things, but when I tap the search bar to start a search, I animate the cancel button into view. Because the search bar is positioned slightly to the right, the animation is jerky and the cancel button falls off the end like so: link text It seems as if the UINavigationItem is like a table with three cells, where there is a padding on the first and last which I can't remove - nor does there seem to be a way to 'merge' it all together and then place the search bar there. I know this look is possible, because the AppStore search has a search bar in the navigation bar and it goes all the way to the edges. Anyone know how to get the search bar to go all the way to the edges so my slide-in cancel button animation will work properly?

    Read the article

  • jerky animation using Core Animation

    - by Paul from Boston
    In my iPhone app, I am trying to get some red and white stripes that are scrolling across the screen to animate smoothly when the speed of the stripes gets high. In my app the user starts the animation and changes the scrolling speed by a finger swipe and changes the width of the stripes by a two finger pinch. Animation is stopped in response to a double tap. If the speed gets high or the stripes get narrow the animation is no longer smooth to the eye. The edges of the stripes seem to jump around. The animation is simple. I draw the stripes in a layer that's a bit larger than the screen. I then set up an animation that moves the layer position by exactly the distance from one red stripe to the next. The duration is set by the speed of the finger swipe and the repeat count is 1. When the animation stops the delegate checks a flag to see if the user wants to stop the scrolling. If not, the animation is restarted again for one cycle. Are there better ways of doing this so that the animation is smooth at high speeds or with narrow stripes? Thanks--

    Read the article

  • UITabbar without controller

    - by Etienne
    Hello. I have a simple app where the only view controller has an outlet to a UITabBar. It also implements UITabBarDelegate and is set as the delegate for the UITabBar: @interface TheMainViewController : UIViewController <UITabBarDelegate> { IBOutlet UITabBar *theTabBar; } I implemented the following method Which gets called whenever any of my 4 UITabBarItems get tapped. I tried just doing something really simple: - (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item { tabBar.selectedItem = [tabBar.items objectAtIndex:0]; return; } In theory, it should always stay selected on my first tab and it works perfectly when I just tap any UITabBarItem (nothing happens, the first one always stays selected). But when I touch a UITabBarItem and hold it (not taking my finger off) the selection changes anyway ! Debugging, everything gets called properly. It's like changing the selectedItem property doesn't have any effect is the user still has the item "down" (with his finger on it). What would be a good workaround? I tried overloading UITabBar and messing with touchesBegan and touchesEnd but they don't even get called. Same with UITabBarItem. Oh and please don't suggest using a UITabBarController as it is not flexible enough for my application. So frustrating....thanks!

    Read the article

  • Random MKAnnotationView is tapped when there are overlapping annotations

    - by Alexandre Gellibert
    I cannot believe this bug/problem doesn't have any solution! In my iphone application, I'm using MapKit with MKMapView and custom MKAnnotationView. The problem is when annotations overlap (in my app, annotations are photos and those photos may overlap) and when you tap on the annotation that appears on front, other annotation (on back) receives the event (seems to be random). I didn't find any way to send the event to the front annotation. Z ordering and Order of overlapping annotations questions on stackoverflow did not help me that much. Please any idea is welcome (even ugly ones)! Here's some of my code (nothing fancy, very common): CustomAnnotation.h @interface CustomAnnotation : NSObject <MKAnnotation> { @private CustomAnnotationView* view; } @property (nonatomic, retain) CustomAnnotationView* view; @end CustomAnnotation.m @implementation CustomAnnotation @synthetize view; CustomAnnotationView.h @interface CustomAnnotationView : MKAnnotationView { } @end CustomAnnotationView.m @implementation CustomAnnotationView - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ // Do something related to the annotation tapped } @end Main class ... // Annotations are added and some of them overlaps with others. - (void)addAnnotation:(CustomAnnotation*)annotation { [map addAnnotation:annotation]; } ... - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { NSString* identifier = getIdentifierFromAnnotation(annotation); CustomAnnotationView* view; if(!(view = (CustomAnnotationView*)[map dequeueReusableAnnotationViewWithIdentifier:identifier])) { view = [[CustomAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier: identifier]; [(CustomAnnotation*)annotation setView:view]; [view release]; } return view; }

    Read the article

  • iPad Safari's mapping of mouse events to touch events in image-maps

    - by Tim
    My website makes extensive use of image-maps. The images are of pages from a medieval manuscript. The mouseOver event of the AREA tags has a tooltip attached to it, which displays a modern typographic transcription of the ancient script for the line the mouse is hovering over. I just checked my website out on the iPad at the Apple store. The iPad is many respects a joy to use, however, I am wondering about Apple's mapping of the mouseEvents to the finger-touch events. Apple probably had a good reason for doing things as they did, but their choices seem counterintuitive an overly complicated to me. Specifically, the iPad Safari browser clearly was responding to both fingerDown and fingerTap, and in different ways. When I tapped an area of the image-map, the tooltip wired to the mouse-over event pf the AREA tag was displayed, and remained visible until I tapped somewhere else. When I held my finger down on an area of the image-map, the area changed color. So if iPad Safari detects a mouseOver eventhandler, it executes the mouseOver code and apparently prevents the "click" event from propagating, so that if you also have something wired to the click event, it doesn't work? Is that right? But more importantly, why isn't fingerDown the iPad-Safari counterpart for mouseOver? FingerDown seems a more likely candidate than Tap when mapping the mousePOver event. I would have expected things to be mapped in this way: MouseClick : FingerTap (i.e. finger down and then immediately up) MouseOver : FingerDown (finger down and stays on the spot) If Apple had treated fingerDown as the counterpart to mouseOver, then the tooltip could be displayed upon FingerDown and made invisible again on fingerUp, which would be the counterpart to mouseOut. Perhaps someone could enlighten me about the thinking process that led Apple to these particular mouse-to-touch event-mappings? Thanks

    Read the article

  • Intercepting/Hijacking iPhone Touch Events for MKMapView

    - by Shawn
    Is there a bug in the 3.0 SDK that disables real-time zooming and intercepting the zoom-in gesture for the MKMapView? I have some real simple code so I can detect tap events, but there are two problems: zoom-in gesture is always interpreted as a zoom-out none of the zoom gestures update the Map's view in realtime. In hitTest, if I return the "map" view, the MKMapView functionality works great, but I don't get the opportunity to intercept the events. Any ideas? MyMapView.h: @interface MyMapView : MKMapView { UIView *map; } MyMapView.m: - (id)initWithFrame:(CGRect)frame { if (![super initWithFrame:frame]) return nil; self.multipleTouchEnabled = true; return self; } - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { NSLog(@"Hit Test"); map = [super hitTest:point withEvent:event]; return self; } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"%s", __FUNCTION__); [map touchesCancelled:touches withEvent:event]; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent*)event { NSLog(@"%s", __FUNCTION__); [map touchesBegan:touches withEvent:event]; } - (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event { NSLog(@"%s, %x", __FUNCTION__, mViewTouched); [map touchesMoved:touches withEvent:event]; } - (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event { NSLog(@"%s, %x", __FUNCTION__, mViewTouched); [map touchesEnded:touches withEvent:event]; }

    Read the article

  • UITextField in UIAlertView doesn't respond to cut/copy/paste on second showing

    - by Jesse Grosjean
    I"m adding a UITextView to a UIAlertView with the following code: UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Enter Name Here" message:@"this gets covered!" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:@"OK!", nil]; UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12, 45, 260, 25)]; CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0, 60); [alert setTransform:myTransform]; [myTextField setBackgroundColor:[UIColor whiteColor]]; [alert addSubview:myTextField]; [alert show]; [alert release]; [myTextField release]; If I place that code in a standard action method: - (IBAction)testAlertView:(id)sender { ...the above code... } Then the first time I show the alert view the cut/copy/paste popup menu will show in the text fields that's been added to the alert view. (For instance if I tap and hold, then "Paste" will popup after I release. The problem is after working correctly the first time, none of the cut/copy/paste buttons will show up again when I show the alert view unless I restart the app. Does anyone know why, or how to fix this problem? Bonus information I just found out that I can get things to always work if I create an show the alert within a UIActionSheet delagate callback. For instance this always works (cut/copy/paste always shows up when in the UITextField when appropriate) - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { ...the above code... } Any idea what might be happening in this second case that make things work? I don't want to use a UIActionSheet in my app, so I'd like to find a way to make it work from a plain old action method. Thanks, Jesse

    Read the article

  • UITextField in UIAlertView doesn't respond to cut/copy/paste on second showing

    - by Jesse Grosjean
    Edit Reposting... I accidentally marked my previous question as "commuity wiki" and didn't realize that answers to wiki posts don't generate reputation. I"m adding a UITextView to a UIAlertView with the following code: UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Enter Name Here" message:@"this gets covered!" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:@"OK!", nil]; UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12, 45, 260, 25)]; CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0, 60); [alert setTransform:myTransform]; [myTextField setBackgroundColor:[UIColor whiteColor]]; [alert addSubview:myTextField]; [alert show]; [alert release]; [myTextField release]; If I place that code in a standard action method: (IBAction)testAlertView:(id)sender { ...the above code... } Then the first time I show the UIAlertView the cut/copy/paste popup menu will show in UITextField that's been added to the UIAlertView. (For instance if I tap and hold, then "Paste" will popup after I release. The problem is after working correctly the first time, none of the cut/copy/paste buttons will show up again next time I show the UIAlertView (new instance) unless I restart the app. Does anyone know why, or how to fix this problem? Bonus information I just found out that I can get things to always work if I create an show the alert within a UIActionSheet delagate callback. For instance this always works (cut/copy/paste always shows up when in the UITextField when appropriate) (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { ...the above code... } Any idea what might be happening in this second case that make things work? I don't want to use a UIActionSheet in my app, so I'd like to find a way to make it work from a plain old action method. Thanks, Jesse

    Read the article

  • Implementing Autocompletion in iPhone UITextField for contacts in address book

    - by nacho4d
    Hi, I would like to have a UITextField or UITextView in where as I do some input, alternatives will appear something similar to when you type an address in Mail Application, alternatives appear down and is possible tap them so get a better input user interface.(since there is no need to type the complete word or address or phone number) I do know how to fetch data from Address Book framework, also how to input text in UITextField/UITextView and its delegates but I don't know what kind of structure to use for fetching and showing data as the user do his/her input. I know basic CoreData if this matters, I hope I can get some help. UPDATE (2010/3/10): I don't have problem make a native-like GUI but I am asking about the algorithm, does any body knows what kind algorithm is best for this thing? maybe some binary tree? Or should I just fetch data from coredata everytime? Thanks Ignacio UPDATE (2010/03/28): I've been very busy these days, so I have not tried UISearchResults but it seems fine to me. BUT I wonder was there a necessity of deletion of the wining answer? I don't think is fair my reputation went down and couldn't see the winning answer. ;(

    Read the article

  • Traversing/Manipulating new window from parent window with jquery

    - by Anthony
    I found a question already with a possible solution, but I had already tried the method suggested before reading it, and it even says it's inconsistent. So I guess I'm wondering why this doesn't work: $("img").click(function() { var imgwindow = window.open('imgwin.html','','width=460,height=345'); alert(imgwindow.find("img").attr("src")); }); The goal is to set the new window's img to the same src as the image that the user clicked to open the new window. But in the above scenario, I'm just trying to tap into the new window to get what it's already-set src. I have imgwin.html already written with a default src for the image, so it should alert that url. Instead I just get undefined. I also tried the following (which should be identical on the back end), but with the same results: $("img").click(function() { var imgwindow = window.open('imgwin.html','','width=460,height=345'); alert($("img",imgwindow).attr("src")); }); I even tried variations of wrapping the imgwindow variable in $() in case somehow jquery wasn't picking up on the variable as a DOM element. The only thing I can guess is that since window.open() is a method, jquery doesn't treat it like a DOM element, even though all documentation from basic javascript tutorials treat the variable as both a method to open the window and the pointer to the window's inner DOM.

    Read the article

  • IPhone SDK - Transition to NavigationController display problem

    - by Steblo
    Hi, I am nearly finished with my first IPhone app and everything works fine - except of one very little display bug: My starscreen is an UIView (Fullscreen) without Navigationbar or Toolbar. If I tap on a start button, there is an UIViewAnimationTransitionFlipFromRight animation that flips to the main navigation controller: -(IBAction) switchViewToMainMenu { [UIView beginAnimations:@"Flip View" context:nil]; [UIView setAnimationDuration:1.25]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:self.window cache:YES]; [self.navController viewWillAppear:YES]; [self.startScreenViewController viewWillDisappear:YES]; [self.startScreenViewController.view removeFromSuperview]; [self.window addSubview:navController.view]; [self.startScreenViewController viewDidDisappear:YES]; [self.navController viewDidAppear:YES]; [UIView commitAnimations]; self.startScreenViewController=nil; [startScreenViewController release]; } This works fine except of one little problem: When the navigation controller view appears (flips in), the Navigationbar on top is some pixels too high (the is a white bar where the Navigationbar should be). When the animation finished, the Navigationbar drops down to the right position. This doesn't look very beautiful... Any ideas how to fix that problem ?

    Read the article

  • How do I hook into the action method for an iPad popover toolbar button?

    - by Elisabeth
    Hi, I am using the split view template to create a simple split view that has, of course, a popover in Portrait mode. I'm using the default code generated by template that adds/removes the toolbar item and sets the popover controller and removes it. These two methods are splitViewController:willShowViewController:... and splitViewController:willHideViewController:... I'm trying to figure out how to make the popover disappear if the user taps on the toolbar button while the popover is displayed. You can make the popover disappear without selecting an item if you tap anywhere outside the popover, but I would also like to make it disappear if the user taps the button again. Where I'm stuck is this: there doesn't seem to be an obvious, easy way to hook into the action for the toolbar button. I can tell, using the debugger, that the action that's being called on the button is showMasterInPopover. And I am new to working with selectors programmatically, I admit. Can I somehow write an action and set it on the toolbar item without overriding the action that's already there? e.g. add an action that calls the one that's there now? Or would I have to write an action that shows/hides the popover myself (behavior that's being done behind the scenes presumably by the split view controller now???). Or am I missing an easy way to add this behavior to this button without changing the existing behavior that's being set up for me? Thank you!

    Read the article

  • - (void)keyboardWasShown not called when switching to another UITextField

    - by Shawn
    I'm having a strange problem that I don't understand. I have a UIScrollView with several UITextField objects. When I switch to the view, I set the first UITextField as firstresponder, and the keyboardWasShown method gets called due to the UIKeyboardDidShowNotification that the view is registered for. The weird thing is, when I touch the next UITextField, the keyboardWasShown method is not called. I don't understand this, since Apple's documentation says "If your interface has multiple text fields, the user can tap between them to edit the values in each one. When that happens, however, the keyboard does not disappear but the system does still generate UIKeyboardDidShowNotification notifications each time editing begins in a new text field." My code I've copied directly from Apple's documentation as well, and it works properly, but it only gets called the first time. What am I missing? - (void)registerForKeyboardNotifications { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name:UIKeyboardDidShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasHidden:) name:UIKeyboardDidHideNotification object:nil]; } - (void)keyboardWasShown:(NSNotification *)aNotification { //if (keyboardShown) return; NSDictionary* info = [aNotification userInfo]; CGSize kbSize = [[info objectForKey:UIKeyboardBoundsUserInfoKey] CGRectValue].size; CGRect bkgndRect = activeField.superview.frame; bkgndRect.size.height += kbSize.height; [activeField.superview setFrame:bkgndRect]; [scrollView setContentOffset:CGPointMake(0.0, activeField.frame.origin.y) animated:YES]; keyboardShown = YES; UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done)]; self.navigationItem.rightBarButtonItem = doneButton; [doneButton release]; }

    Read the article

  • How to persist options selected in AlertDialog spawned from ItemizedOverlay onTap method

    - by ahsteele
    In the description of how to add a list of options to an AlertDialog the official Android documentation alludes to saving a users preferences with one of the "data storage techniques." The examples assume the AlertDialog has been spawned within an Activity class. In my case I've created a class that extends ItemizedOverlay. This class overrides the onTap method and uses an AlertDialog to prompt the user to make a multi-choice selection. I would like to capture and persist the selections for each OverlayItem they tap on. The below code is the onTap method I've written. It functions as written but doesn't yet do what I'd hope. I'd like to capture and persist each selection made by the user to be used later. How do I do that? Is using an AlertDialog in this manner a good idea? Are there better options? protected boolean onTap(int index) { OverlayItem item = _overlays.get(index); final CharSequence[] items = { "WiFi", "BlueTooth" }; final boolean[] checked = { false, false }; AlertDialog.Builder builder = new AlertDialog.Builder(_context); builder.setTitle(item.getTitle()); builder.setMultiChoiceItems(items, checked, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int item, boolean isChecked) { // for now just show that the user touched an option Toast.makeText(_context, items[item], Toast.LENGTH_SHORT).show(); } }); builder.setPositiveButton("Okay", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // should I be examining what was checked here? dialog.dismiss(); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); return true; }

    Read the article

  • UISearchDisplayController not working when created in code??

    - by Nick Bedford
    I'm working on a tab bar application and one of the tabs has a UISearchDisplayController hooked up to a UISearchBar. It's all connected up in the NIB and is working. When I tap the search bar, the Scope and Cancel buttons fly in etc, and the search delegate updates the results table correctly. However, I'm trying to implement the same code in the viewDidLoad message instead of the NIB, however when I delete the search display controller from the NIB and uncomment my code to create the same controller in the function, it doesn't work. It's as if there's some fundamental connection not being made so that all my search delegate functionality isn't being called. Here's my working NIB version of the Search Display Controller. It's hooked up to the search bar, the UINavigationController subclass (MASearchController) and the root view of that is hooked up as the searchContentsController. Now this is what you would expect to do in code to create the same, right? What I'm doing is leaving the UISearchBar in the NIB to eliminate one piece of the puzzle at a time in code. // [MASearchController viewDidLoad] UISearchDisplayController *searchController = [[[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:[[self viewControllers] objectAtIndex:0]] autorelease]; [searchController setDelegate:self]; [searchController setSearchResultsDelegate:self]; [searchController setSearchResultsDataSource:self]; I've checked all objects at run time and they all check out. Essentially I've deleted the search display controller from the NIB and then put in the code to create it in the viewDidLoad message. Why would this not work? The search keyboard comes up but none of my search and button animation functionality work???

    Read the article

  • how to set UISwitch pointer to access switch from one uiviewcontroller another uiviewcontroller

    - by Rkm
    System UIViewcontroller has button event.Tap on Button fire InfoTableviewController. InfoTableview has UISwitch . How to set NSMutableArray of UIswitch pointer for System UIViewcontroller to access switch . SystemUIviewcontroller button event - (IBAction) Info_Button_Clicked:(id) sender { // pushcontroller Info *info = [[Info alloc]initWithNibName:@"Info" bundle:[NSBundle mainBundle]]; [self.navigationController pushViewController:info animated:YES]; [info release]; } Here for Info TableviewController // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = nil; if ([indexPath section] == 0) { static NSString *kDisplayCell_ID = @"DisplayCellID"; cell = [self.tableView dequeueReusableCellWithIdentifier: kDisplayCell_ID]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: kDisplayCell_ID] autorelease]; cell.selectionStyle = UITableViewCellSelectionStyleNone; } else { // the cell is being recycled, remove old embedded controls UIView *viewToRemove = nil; viewToRemove = [cell.contentView viewWithTag:1]; if (viewToRemove) [viewToRemove removeFromSuperview]; } cell.textLabel.text = [[self.Soundarray objectAtIndex: indexPath.row] valueForKey:@"labelKey"]; UIControl *control = [[self.Soundarray objectAtIndex: indexPath.row] valueForKey:@"viewKey"]; [cell.contentView addSubview:control]; return cell; } }

    Read the article

  • Create a VPN with Python

    - by user213060
    I want to make a device "tunnel box" that you plug an input ethernet line, and an output ethernet line, and all the traffic that goes through it gets modified in a special way. This is similar to how a firewall, IDS, VPN, or similar boxes are connected inline in a network. I think you can just assume that I am writing a custom VPN in Python for the purpose of this question: LAN computer <--\ LAN computer <---> [LAN switch] <--> ["tunnel box"] <--> [internet modem] <--> LAN computer <--/ My question is, what is a good way to program this "tunnel box" from python? My application needs to see TCP flows at the network layer, not as individual ethernet frames. Non-TCP/IP traffic such as ICPM and other types should just be passed through. Example Twisted-like Code for my "tunnel box" tunnel appliance: from my_code import special_data_conversion_function class StreamInterceptor(twisted.Protocol): def dataReceived(self,data): data=special_data_conversion_function(data) self.outbound_connection.send(data) My initial guesses: TUN/TAP with twisted.pair.tuntap.py - Problem: This seems to only work at the ethernet frame level, not like my example? Socks proxy - Problem: Not transparent as in my diagram. Programs have to be specifically setup for it. Thanks!

    Read the article

  • presentModalViewController does not want to work when called from a protocol method

    - by johnbdh
    I have a subview that when double tapped a protocol method on the subview's parent view controller is called like this... - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *theTouch = [touches anyObject]; if (theTouch.tapCount == 1) { } else if (theTouch.tapCount == 2) { if ([self.delegate respondsToSelector:@selector(editEvent:)]) { [self.delegate editEvent:dictionary]; } } } Here is the protocol method with the dictionary consuming code removed... - (void)editEvent:(NSDictionary){ EventEditViewController *eventEditViewController = [[EventEditViewController alloc] initWithNibName:@"EventEditViewController" bundle:nil]; eventEditViewController.delegate = self; navigationController = [[UINavigationController alloc] initWithRootViewController:eventEditViewController]; [self presentModalViewController:navigationController animated:YES]; [eventEditViewController release]; } The protocol method is called and runs without any errors but the modal view does not present itself. I temporarily copied the protocol method's code to an IBAction method for one of the parent's view button's to isolate it from the subview. When I tap this button the modal view works fine. Can anyone tell me what I am doing wrong? Why does it work when executed from a button on the parent view, and not from a protocol method called from a subview. Here is what I have tried so far to work around the problem... Restarted xCode and the simulator Ran on the device (iTouch) Presenting eventEditViewController instead of navigationController Using Push instead of presentModal. delaying the call to the protocol with performSelector directly to the protocol, to another method in the subview which calls the protocol method, from the protocol method to another method with the presentModal calls. Using a timer. I have it currently setup so that the protocol method calls a known working method that presents a different view. Before calling presentModalViewController it pops a UIAlertView which works every time, but the modal view refuses to display when called via the protocol method. I'm stumped. Perhaps it has something to do with the fact that I am calling the protocol method from a UIView class instead of a UIViewController class. Maybe I need to create a UIViewController for the subView?? Thanks, John

    Read the article

  • Adding a UITapGestureRecognizer to a view then removing seems to short circuit button events

    - by heymon
    In the code below I am popping up a ImageView as the result of a users touchUpInside on a simple info button. There are other buttons on the view. To dismiss the info I added a UITapGestureRecognizer to my controllers view, and hide the view when the tap is detected. If I don't remove the tapGestureRecognizer, the action is called every time some. Even when I do remove the gesture action, no bottons receive touchUpInside events once this gesture recognizer is added. Why? Code from my MainViewController (void) dismissInfo: (UITapGestureRecognizer *)gesture { [kInfoView setHidden: YES]; [gesture removeTarget: self action: NULL]; } (IBAction) displayInfo { CGRect startFrame = CGRectMake(725, 25, 0, 0), origFrame; CGFloat yCenter = [kInfoView frame].size.height/2 + 200; CGPoint startCenter = CGPointMake(724, 25), displayCenter = CGPointMake(384, yCenter); UITapGestureRecognizer *g = [[UITapGestureRecognizer alloc] initWithTarget: self action: @selector(dismissInfo:)]; [self.view addGestureRecognizer: g]; origFrame = [kInfoView frame]; [kInfoView setCenter: startCenter]; [kInfoView setHidden: NO]; [kInfoView setFrame: startFrame]; [UIView beginAnimations: @"info" context: nil]; [UIView setAnimationDuration: .5]; [UIView setAnimationDelegate: self]; [kInfoView setFrame: origFrame]; [kInfoView setCenter: displayCenter]; [UIView commitAnimations]; }

    Read the article

  • Save options selected in AlertDialog spawned from ItemizedOverlay onTap method

    - by ahsteele
    In the description of how to add a list of options to an AlertDialog the official Android documentation alludes to saving a users preferences with one of the "data storage techniques." The examples assume the AlertDialog has been spawned within an Activity class. In my case I've created a class that extends ItemizedOverlay. This class overrides the onTap method and uses an AlertDialog to prompt the user to make a multi-choice selection. I would like to capture and persist the selections for each OverlayItem they tap on. That said I am unsure if utilizing an AlertDialog in this manner is the right approach and open to other suggestions. protected boolean onTap(int index) { OverlayItem item = _overlays.get(index); final CharSequence[] items = { "WiFi", "BlueTooth" }; final boolean[] checked = { false, false }; AlertDialog.Builder builder = new AlertDialog.Builder(_context); builder.setTitle(item.getTitle()); builder.setMultiChoiceItems(items, checked, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int item, boolean isChecked) { // for now just show that the user touched an option Toast.makeText(_context, items[item], Toast.LENGTH_SHORT).show(); } }); builder.setPositiveButton("Okay", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // should I be examining what was checked here? dialog.dismiss(); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.show(); return true; }

    Read the article

  • Android accessibility focus - clicking a view changes focus to previous view

    - by benkdev
    I'm using android TalkBack to test my application for accessibility use. When I swipe to select a view and double tap, the focus returns the the view above it. Usually when swiping to a view and double clicking it, onClick is called. What am I doing wrong? <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/all_white" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/header" android:scaleType="center" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/green_bar" android:scaleType="center" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/blue_bar" android:scaleType="center" /> <EditText android:id="@+id/username" android:layout_width="325dp" android:layout_height="wrap_content" android:hint="@string/username" android:focusable="true" android:nextFocusDown="@id/password" /> <EditText android:id="@+id/password" android:inputType="textPassword" android:layout_width="325dp" android:layout_height="wrap_content" android:hint="@string/password" android:focusable="true" android:nextFocusUp="@id/username" android:nextFocusDown="@id/login" /> <Button android:id="@+id/login" android:onClick="doLogin" android:focusable="true" android:layout_width="325dp" android:layout_height="wrap_content" android:text="@string/login" android:nextFocusUp="@id/password" android:nextFocusDown="@id/create_trial_account" /> <Button android:id="@+id/create_trial_account" android:layout_width="100dip" android:layout_height="wrap_content" android:text="@string/new_user" android:onClick="createAccount" android:focusable="true" android:nextFocusUp="@id/login" /> <TextView android:id="@+id/copyright" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/copyright" /> <TextView android:id="@+id/buildNumber" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout>

    Read the article

  • Navigation view system with webview problem with touches!

    - by Gonçalo Falcão
    Hello i have search everything and i didn't figure this out! I have a tab bar controller with 5 navigation controlls, in one of the navigation control, i have a view, with a table view inside, and when i click that item i push a new view, that view have view -webview -view i create that second view(is transperant) because i need to handle a single tap to hide my toolbar and navigation bar, and the webview was eating all the touches! I put that view and implement on the view controller -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch* touch = [touches anyObject]; if(touch.tapCount == 2){ [NSObject cancelPreviousPerformRequestsWithTarget:self]; } [[wv.subviews objectAtIndex:0] touchesBegan:touches withEvent:event]; [super touchesBegan:touches withEvent:event]; } -(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ [[wv.subviews objectAtIndex:0] touchesMoved:touches withEvent:event]; [super touchesMoved:touches withEvent:event]; } -(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch* touch = [touches anyObject]; if(touch.tapCount == 1){ [self performSelector:@selector(hideBars) withObject:nil afterDelay:0.3]; } [[wv.subviews objectAtIndex:0] touchesEnded:touches withEvent:event]; [super touchesEnded:touches withEvent:event]; } -(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{ [[wv.subviews objectAtIndex:0] touchesCancelled:touches withEvent:event]; [super touchesCancelled:touches withEvent:event]; } wv is my UIWebView IBOutlet now i can get the the touches in my controller and send them to my webview. So i thought everything was working, i'm able to scroll, but now when i have links i'm not able to click them. And the webview is detecting the links i have made that test. So any other way to implements this to get the touches in the links, or i should change this workaround to hide the toolbars so i can have the full functionability of the webview? Thks for the help in advance.

    Read the article

  • How can I attach a file using Wordpress custom fields / meta boxes?

    - by shipshape
    I am using Wordpress's add_meta_box() function to add customized meta fields to the Add New Post page, like this. I want one of these fields to allow the user to upload a file, so that a single image, pdf, audio file, or video can be associated with the post. The closest example I've seen is this one. Unfortunately it does not suit my needs, as I want my file to be processed by Wordpress's Media Uploader - so it should appear in the Media Library afterwards, and thumbnails should be generated according to the Media settings. I think ideally there would be a way to tap into Wordpress's existing Add Media dialog, and simply output the URL of the uploaded file into a text box, but I don't see how to do that. This question is similar, but the answers are a little clunky - I would like to keep this super simple for my end users. How can I accomplish this? Please do not recommend plugins such as Flutter or Magic Fields - I have tried these and they do not suit my purposes (I want the images to be processed by Wordpress's Media Uploader). I am using Wordpress 3.0-alpha. Thanks!

    Read the article

< Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >