Search Results

Search found 6486 results on 260 pages for 'cocoa touch'.

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

  • MKAnnotationView for userLocation pin iPhone

    - by Mauricio Galindo
    I have an application that uses MKMapView and at some point in the app I need to remove all the current pins in the map using [mapView removeAnnotations:mapView.annotations] And then I want to show again the current user location mapView.showUserLocation = YES But I can only make it reappear as a regular pin, because the userLocation view class its not public so I cant return views of that type. Here is my code - (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation MKPinAnnotationView* annView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"currentloc"]; if (!annView) { MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"]; annView.pinColor = MKPinAnnotationColorRed; annView.animatesDrop=TRUE; annView.canShowCallout = YES; annView.calloutOffset = CGPointMake(-5, 5); if ([annotation isKindOfClass:[DraggableAnnotationAM class]] ) annView.draggable = YES; return annView; } else { if ([annotation isKindOfClass:[DraggableAnnotationAM class]] ) annView.draggable = YES; annView.annotation = annotation; return annView; } Also I have found through reflection that MKUserLocationView is the class that is used to display the current location, but because its not public its not safe to use and my app keeps crashing and Im sure theres a easier way. Is it possible to do what I want, or should I just never remove the user location annotation of the mapView? Thanks in advance

    Read the article

  • How do I return the entire set / array using NSPredicate?

    - by Prairiedogg
    I'm building a carArray and want to filter the contents conditionally, using an NSPredicate, like so: NSPredicate *pred; switch (carType) { case FreeCar: pred = [NSPredicate predicateWithFormat:@"premium = NO"]; break; case PremiumCar: pred = [NSPredicate predicateWithFormat:@"premium = YES"]; break; default: pred = [NSPredicate predicateWithFormat:@"SOME PREDICATE THAT RETURNS EVERYTHING"]; break; } self.carArray = [aCarArrayIGotFromSomewhere filteredArrayUsingPredicate:pred]; My question is, what is the correct syntax for the value I've stubbed in as SOME PREDICATE THAT RETURNS EVERYTHING which returns all of the instances in the array / set? PS - I know the answer and will post it immediately, just sharing it for everyone's reference as an earlier search on SO did not yield the result.

    Read the article

  • Threading questions

    - by JK
    If I spawn a secondary thread and the threaded method calls other methods, are those methods run in the secondary thread or the main thread? Is there a way to determine on which thread a specified piece of code is being run?

    Read the article

  • Background problem on UITableView

    - by f0rz
    Hi ! I have come to a problem, wich I have no idea how to solve. Can anyone think outside the box and point me to right directions? I would be very thankfull ! The problem. I have a UITableView containing a first row wich is always the same (a empty row with repeating background) Next rows are bounch of dynamic data rows. I have set the yellow background on my UITableView in IBuilder, My cells (except first row) have white background with code: UIView* backgroundView = [ [ [ UIView alloc ] initWithFrame:CGRectZero ] autorelease ]; backgroundView.backgroundColor = [UIColor colorWithRed: 0.96078431372549 green: 0.96078431372549 blue: 0.96078431372549 alpha: 1.0]; cell.backgroundView = backgroundView; for ( UIView* view in cell.contentView.subviews ) { view.backgroundColor = [ UIColor clearColor ]; } The example yellow background, I only want to be showed at the top. As u see img example below. The thing is I dont want to have yellow background under the last datarow, I want to contain same white color I have on the cells. This should be white as the cells. Not yellow. Thank u for your time. Regards

    Read the article

  • How to resize a UIPresentationFormSheet?

    - by Sheehan Alam
    I am trying to display a modal view controller as a UIPresentationFormSheet. The view appears, but I can't seem to resize it. My XIB has the proper height & width, but it seems to get overridden when I call it like this: composeTweetController = [[ComposeTweet alloc] initWithNibName:@"ComposeTweet" bundle:nil]; composeTweetController.modalPresentationStyle = UIModalPresentationFormSheet; [self presentModalViewController:composeTweetController animated:TRUE]; Any thoughts? I am using the iPhone SDK 3.2 beta 4

    Read the article

  • showing current location ,along with another location in iphone

    - by ratnasomu
    hellow all, in xcode whenever we load a mapview ,it automaticallay shows the current user location right. In my case i am showing another location on map ,such that the map loads the current location and zoomed to the location i have given .. but, the current location point was not showing (the blue one which comes automaticay..). i have given mapView.showCurrentLocation=TRUE; but its not showing . so could any one tells the way it works and it should say the current location mark and then zoomed to the point i have given. Thanks

    Read the article

  • Why would the first call to a KVC setter have an NSTextField instance as the argument?

    - by Stephen
    If I have a NSTextField bound through an NSObjectController to a model object, I would expect the setter of the model object to be called with an NSString as the argument, but instead, I receive the instance of the control that I am bound too the first time I am called. - (NSString *)property { NSLog(@"returning property"); return property; } - (void)setProperty:(NSString *)string { NSLog(@"recieved %@", string) } - (id) init { if (self = [super init]) { property = [[NSString alloc] initWithString:@"value"]; } NSLog(@"property is %@",property"); return self; } (The program doesn't run if you try anything in setProperty, because it tries to send NSString messages to string - which might be an NSTextField.) Console Output: 2010-05-12 14:19:14.096 Trouble[13108:10b] property is enter value 2010-05-12 14:19:14.100 Trouble[13108:10b] recieved <NSTextField: 0x1025210> 2010-05-12 14:19:14.106 Trouble[13108:10b] returning property

    Read the article

  • UTF-8 conversion

    - by leachianus
    Hey guys, I am grabbing a JSON array and storing it in a NSArray, however it includes JSON encoded UTF-8 strings, for example pass\u00e9 represents passé. I need a way of converting all of these different types of strings into the actual character. I have an entire NSArray to convert. Or I can convert it when it is being displayed, which ever is easiest. I found this chart http://tntluoma.com/sidebars/codes/ is there a convenience method for this or a library I can download? thanks, BTW, there is no way I can find to change the server so I can only fix it on my end...

    Read the article

  • Search resetting selection in tableview

    - by Jay
    I've got an NSTableView bound to an NSArrayController via content and selection indexes. All great so far - content displayed, etc. Now an NSSearchField is bound to the array controller via filterPredicate and the property of the array content instances that's to be searched. Searching/filtering the table view works great; table view showing only matching entries. However, searching resets the selection on the NSTableView if the existing selection isn't in the search results. Worse, not only during the search but after ending the search there's no selection on the table view. The NSArrayController is set up to Avoid Empty Selection. Any hints on how to properly configure bindings in this scenario to really prevent an empty selection much appreciated!

    Read the article

  • handling the logout functionality on the iPhone

    - by Nanz
    This is the first iPhone application i am working on. To use the application, the user has to login to our server. I am done with that part. Now the problem i am facing is how to logout the user from the server, deallocate all the memory and start afresh without quitting the app. After the user logs out, i want the exact same things to happen as in applicationdidfinishlaunching method. But i dont know how to go about it. The app has a tab bar which is set up in mainWindow.xib.

    Read the article

  • Customizing UISlider look

    - by tcurdt
    To customize the visual look of a UISlider you can set the thumb and track images. Part of the track images gets stretched to the appropriate with. From the documentation: A stretchable region sits between two end cap regions. The end caps define the portions of the image that remain as is and are not stretched. The stretchable region is a 1-point wide area between the end caps that can be replicated to make the image appear longer. Now the problem I have is that my stretchable region needs to be more than 1-point wide. (It's a pattern) Unfortunately the 1-point width seems to be hard coded in the SDK. Anyone having an idea how to work around this? Or will I have to write my own slider from scratch for this?

    Read the article

  • Using Interface Builder tags

    - by pat
    I'm using interface builder's tag feature to access some UILabels I'm instantiating in a xib file. Since this a UITextViewCell I want to avoid superfluous method calls, but I want to do it right too. Thus when I do: UILabel *label = (UILabel *)[cell viewWithTag:1]; I'm wondering if I should wrap it up like so: if([[cell viewWithTag:1] isKindOfClass [UITableViewCell class]]) { UILabel *label = (UILabel *)[cell viewWithTag:1]; } Any discussion on this would be appreciated. Thanks

    Read the article

  • Detecting network adapter changes on the iPhone

    - by theactiveactor
    Say that there are no WIFI networks currently available and my network-enabled app is connected over 3G. How can I detect if a user has roamed into a WIFI network? I would also like to detect the case when the user is connected over WIFI and suddenly received 3G signal. In other words, I would like to be asynchronously notified of network adapter changes. I tried using the SCNetworkReachability framework asynchronously but found that for some reason, I am not receiving Wifi-related events (i.e. adapter on/off) when connected over 3G.

    Read the article

  • Creating a Pop animation similar to the presentation of UIAlertView

    - by JK
    I would like to present a view in the same manner as that of UIAlertView - a pop/spring. Unfortunately subclassing UIAlertView is not an option for the view I need to present. I have written some code, but I can't seem to get it as realistic as I would like. I would appreciate any suggestions for greater realism or a link if anything similar has been done (I could not find anything on Google). Thank you. - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { self.backgroundColor = [UIColor whiteColor]; v = [[UIView alloc] initWithFrame:CGRectMake(140, 140, 60, 60)]; v.backgroundColor = [UIColor blueColor]; [self addSubview:v]; [self animate]; } return self; } - (void)animate { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationCurve:UIViewAnimationCurveLinear]; [UIView setAnimationDuration:0.2]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(popStep1Complete)]; v.frame = CGRectMake(90, 90, 140, 140); [UIView commitAnimations]; } - (void)popStep1Complete { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationCurve:UIViewAnimationCurveLinear]; [UIView setAnimationDuration:0.15]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(popStep2Complete)]; v.frame = CGRectMake(110, 110, 100, 100); [UIView commitAnimations]; } - (void)popStep2Complete { [UIView beginAnimations:nil context:NULL]; [UIView setAnimationCurve:UIViewAnimationCurveLinear]; [UIView setAnimationDuration:0.15]; v.frame = CGRectMake(100, 100, 120, 120); [UIView commitAnimations]; }

    Read the article

  • CGGradient in an CGPath

    - by catlan
    Is it possible to draw a gradient in a path on the iPhone? I'm looking for a replacement of the mac os x method -drawInBezierPath:(NSBezierPath *)path relativeCenterPosition:(NSPoint)relativeCenterPosition of NSGradient.

    Read the article

  • NSFetchedResultsController not processing certain section driven moves

    - by JK
    I utilize a NSFetchedResultsController (frc) with a Core Data store. I implement all the frc delegate methods. The table is sporadically updated by background threads. All the inserts, deletes and updates work fine, with the exception that updates to the frc's index key for rows toward to the bottom of the table (50 rows), do not result in a section move. e.g. if "name" is the index key and the name "Victor" is changed to "Alex", the victor row now shows the name Alex, but is not moved to the top of the table alongside all other names starting with A. As I noted, this is only for rows towards the bottom of the table. If a row like "Andy" is changed to "Ben", the move is indeed processed correctly by the frc. Any suggestions to fix this would be appreciated. I do not use a frc cache. Thanks

    Read the article

  • Remove year component from NSDateFormatter style

    - by JK
    I would like to present a date in the kCFDateFormatterFullStyle, but without the year. Is there any way to remove the year component from this style? My app requires localization so practically I cannot programmatically set the format string for all locales. I have come accross a solution which removes the "y" characters from the format string returned by the built in styles. Unfortunately, this is not acceptable as the year components are not represented by "y" in some other languages like Japanese. Any suggestions to get the kCFDateFormatterFullStyle without the year would be great! Thanks.

    Read the article

  • Release Quickie

    - by Meltemi
    How to succinctly handle this situation. I'm not properly releasing contactDictionary in the if statement... NSNumber *pIDAsNumber; ... NSMutableDictionary *contactDictionary = [NSMutableDictionary dictionaryWithDictionary:[defaults dictionaryForKey:kContactDictionary]]; if (!contactDictionary) { contactDictionary = [[NSMutableDictionary alloc] initWithCapacity:1]; } [contactDictionary setObject:pIDAsNumber forKey:[myClass.personIDAsNumber stringValue]]; [defaults setObject:contactDictionary forKey:kContactDictionary];

    Read the article

  • Core Data: fetch an NSManagedObject by its properties

    - by niklassaers
    Hi guys, I have an object NetworkMember that has no attributes but is defined by its relationships Person, Network, Level and Role. In my app, I've found all the four relationships, but I want to make sure not to double-register my NetworkMember, thus I'd like to search for this NSManagedObject before instantiating it. How should I write a query that queries for an NSManagedObject just consisting of relationships? Cheers Nik

    Read the article

  • iPhone: Does it ever make sense for an object to retain its delegate?

    - by randombits
    According to the rules of memory management in a non garbage collected world, one is not supposed to retain a the calling object in a delegate. Scenario goes like this: I have a class that inherits from UITableViewController and contains a search bar. I run expensive search operations in a secondary thread. This is all done with an NSOperationQueue and subclasses NSOperation instances. I pass the controller as a delegate that adheres to a callback protocol into the NSOperation. There are edge cases when the application crashes because once an item is selected from the UITableViewController, I dismiss it and thus its retain count goes to 0 and dealloc gets invoked on it. The delegate didn't get to send its message in time as the results are being passed at about the same time the dealloc happens. Should I design this differently? Should I call retain on my controller from the delegate to ensure it exists until the NSOperation itself is dealloc'd? Will this cause a memory leak? Right now if I put a retain on the controller, the crashes goes away. I don't want to leak memory though and need to understand if there are cases where retaining the delegate makes sense. Just to recap. UITableViewController creates an NSOperationQueue and NSOperation that gets embedded into the queue. The UITableViewController passes itself as a delegate to NSOperation. NSOperation calls a method on UITableViewController when it's ready. If I retain the UITableViewController, I guarantee it's there, but I'm not sure if I'm leaking memory. If I only use an assign property, edge cases occur where the UITableViewController gets dealloc'd and objc_msgSend() gets called on an object that doesn't exist in memory and a crash is imminent.

    Read the article

  • How can I consolidate deferred/delayed calls in Objective-C ?

    - by thrusty
    I'd like to ensure that certain maintenance tasks are executed "eventually". For example, after I detect that some resources might no longer be used in a cache, I might call: [self performSelector:@selector(cleanupCache) withObject:nil afterDelay:0.5]; However, there might be numerous places where I detect this, and I don't want to be calling cleanupCache continuously. I'd like to consolidate multiple calls to cleanupCache so that we only periodically get ONE call to cleanupCache. Here's what I've come up with do to this-- is this the best way? [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(cleanupCache) object:nil]; [self performSelector:@selector(cleanupCache) withObject:nil afterDelay:0.5];

    Read the article

  • How to edit an default Xcode template?

    - by HelloMoon
    When I create an NSObject subclass, I always get an empty implementation. There are some things I always put in my code like pragma marks and -dealloc methods. I prefer to just delete stuff that I don't need over writing it with typos from scratch every time I need it. I need -dealloc and -init almost always, but they don't ship with the default template. Is there a way to customize what's in there?

    Read the article

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