iphone-sdk-3.0

Search and display business locations on MKMapView

风流意气都作罢 提交于 2019-11-29 02:34:45
I'm trying to find a way to search for a business, such as "grocery stores" and display them on a google map around the users current location. This used to be pretty simple with the old URL style of launching the apple map location but I can't find out how to do it with the MKMapView. I understand that I'll need to use the MKAnnotations classes but my problem is with finding the data. I've tried plugging in the URL below to get the info from google but the size of the data seems way too large. http://maps.google.com/maps?q=grocery&mrt=yp&sll=37.769561,-122.412844&z=14&output=kml Is there an

iPhone Auto-scroll UITextView but allow manual scrolling also

这一生的挚爱 提交于 2019-11-29 02:32:38
I have a UITextView that has a lot of content. I have a button that allows the UITextView to automatically scroll + 10 pixels in an NSTimer loop: scrollPoint = CGPointMake(scrollPoint.x, scrollPoint.y + 10); [textView setContentOffset:scrollPoint animated:YES]; This works really well, as the animation makes the scroll rather smooth. I want to allow the user to skip ahead or back by scrolling with their finger, however due to this code after the scroll animation, the scroll snaps back to where it would have auto-scrolled. I need to reset the scrollPoint variable after a manual scroll, but I'm

How can I get the real time in iPhone, not the time set by user in Settings?

时光毁灭记忆、已成空白 提交于 2019-11-29 02:28:35
I need to ensure that my app gets the correct time, not the time set by the user in settings. So for instance, once the user starts the app, I'd want to get a timestamp. The user would see the elapsed time on a timer on screen updated every second. When the user exits the app, and after some time restarts the app , the timer would just get the current time and compare it with the original timestamp it kept. So basically, just like the stopwatch in the Clock.App on iPhone. Now the problem with the clock.app is that if the user goes and advances the time in Settings by one hour, this will

how to detect and program around shakes for the iphone

北城以北 提交于 2019-11-29 02:27:36
I'm trying to implement the shake "tutorial" on this page, but I think I'm missing something. I copied his accelerometer function into myAppViewController.m file and put some nslogs in there to see if it even gets into the function when I use the simulators "shake" function. Nothing shows up in the debug console. http://mithin.in/2009/07/28/detecting-a-shake-using-iphone-sdk Can anyone explain what I might be missing? Or point me to a tutorial? I found this, which looks promising, but I don't know how to "put it in a UIView" How do I detect when someone shakes an iPhone? EDIT - now here's my

How to exactly find where memory is leaking in project of iPhone

懵懂的女人 提交于 2019-11-29 01:49:13
问题 While developing apps in Xcode memory leaks are occurring. When I checked them in extended detail view they are showing different methods that are not related to implemented. How to exactly find out which object is leaking and where it is leaking memory. When ARC is enabled we have to take care of memory leaks or not? 回答1: Even with ARC memory leaks can occur, it just inserts release and autorelease during compile time. 1. You must check for leaks using Build and analyze in XCode, shift

How can I scroll programmatically to the bottom in a UIWebView?

我怕爱的太早我们不能终老 提交于 2019-11-29 01:01:38
问题 I know a similar question has been asked before but it seemed never been answered. I have a UIWebView and add some content by string. I use UIWebView because I add some images to it dynamically and also use other HTML features. This example code is simplified. NSString *myHtmlString = @"SOME LONG TEST STRING 1234567890 123456789 0123456789 0123456789 0123456789 01234567890 WWWWWWWWWW WWWWWWWWWW WWWYYYYYYY YYYYYYYYYY YYYYYYYYYY YYYYYYYYYY YYYYYYYYYY YYYYYYYYY YYYYYYYWWW WWWWWWWWWW WWWWWWWWWW

average color value of UIImage in Objective-C

丶灬走出姿态 提交于 2019-11-29 01:00:28
问题 I need the average color value of an image in objective c. I want to create a color gradient of it. Has anyone an idea? 回答1: here is an experimental code that i have not tested yet. struct pixel { unsigned char r, g, b, a; }; - (UIColor*) getDominantColor:(UIImage*)image { NSUInteger red = 0; NSUInteger green = 0; NSUInteger blue = 0; // Allocate a buffer big enough to hold all the pixels struct pixel* pixels = (struct pixel*) calloc(1, image.size.width * image.size.height * sizeof(struct

How do I determine if a coordinate is in the currently visible map region?

こ雲淡風輕ζ 提交于 2019-11-29 00:43:24
I have a list of several hundred locations and only want to display an MKPinAnnotation for those locations currently on the screen. The screen starts with the user's current location with a 2 mile radius. Of course, the user can scroll, and zoom on the screen. Right now, I wait for a map update event, and then loop through my location list, and check the coordinates like this: -(void)mapViewDidFinishLoadingMap:(MKMapView *)mapView { CGPoint point; CLLocationCoordinate2D coordinate; . . . /* in location loop */ coordinate.latitude = [nextLocation getLatitude]; coordinate.longitude =

White Text in UITextField = Invisible text in iPhone copy/paste select. Fix?

安稳与你 提交于 2019-11-29 00:42:55
If I have white text in my UITextField, the selection window (when selecting text) is invisible because the background on the little window is also white. Any way to fix this? Sure! The background color of the loupe always matches the backgroundColor property of the text field. (But not the background property.) Example: textField.textColor = [UIColor whiteColor]; textField.backgroundColor = [UIColor blackColor]; If your text field absolutely requires a transparent background, you'll have to fake it—by using a background image containing the graphics underneath the text field. You may do it

iPhone : Transfer of files from Mac/Pc to app

可紊 提交于 2019-11-29 00:30:25
I need to transfer binary files from my pc/mac to my app. I want to allow my users to upload sound files. Am i going to have to run a web server that the user can connect to over wifi? What are the steps i have to go through to get this up and running? In my apps, I use the open-source cocoahttdserver . It is quite trivial to setup in your app and connect to from a computer using the same network. They have an iPhone sample project that you can pretty much cut and paste from for basic functionality. Do you need to transfer the files program-atically or through a GUI? If you can use a GUI,