¡@

Home 

2014/10/15 ¤U¤È 10:14:13

iphone Programming Glossary: simply

How to make a UITextField move up when keyboard is present

http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present

working where I change the frame size of the UIScrollView when the keyboard goes up and down. I'm simply using void textFieldDidBeginEditing UITextField textField Keyboard becomes visible scrollView.frame..

iOS 6 apps - how to deal with iPhone 5 screen size? [duplicate]

http://stackoverflow.com/questions/12396545/ios-6-apps-how-to-deal-with-iphone-5-screen-size

in today's presentation. They will be letterboxed or basically the extra 88 points in height would simply be black. If you only plan to support iOS 6 then definitely consider using Auto Layout. It removes all.. application. A majority of applications that use a standard navigation bar and or tab bar could simply expand the content in the middle to use up that extra points. Set the autoresizing mask of the center..

How to detect iPhone 5 (widescreen devices)?

http://stackoverflow.com/questions/12446990/how-to-detect-iphone-5-widescreen-devices

check the new AutoLayout capabilities. That said if you really need to detect the iPhone 5 you can simply rely on the screen size . UIScreen mainScreen bounds .size.height The iPhone 5's screen has a height..

How do I detect when someone shakes an iPhone?

http://stackoverflow.com/questions/150446/how-do-i-detect-when-someone-shakes-an-iphone

You can easily transform any UIView even system views into a view that can get the shake event simply by subclassing the view with only these methods and then selecting this new type instead of the base..

Remove HTML Tags from an NSString on the iPhone

http://stackoverflow.com/questions/277055/remove-html-tags-from-an-nsstring-on-the-iphone

using regex or NSScanner. Does anyone have a solution to this One suggestion has been to simply look for opening and closing tag characters this method won't work except for very trivial cases. For..

How do I apply a perspective transform to a UIView?

http://stackoverflow.com/questions/347721/how-do-i-apply-a-perspective-transform-to-a-uiview

. If you don't have any sublayers don't worry about it. I use the sublayerTransform in my example simply because there are two CALayers contained within the one layer that I'm rotating. share improve this..

Build fat static library (device + simulator) using Xcode and SDK 4+

http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4

instead of guesstimating them Apple's latest Xcode prevents you from doing what he's done it simply will not work due to the Documented change in how Xcode processes targets Another SO questioner asked..

How to send json data in the Http request using NSURLRequest

http://stackoverflow.com/questions/4456966/how-to-send-json-data-in-the-http-request-using-nsurlrequest

second question is how might I modify the request part of this to do a POST instead of GET Is it simply to modify the HttpMethod like so request setHTTPMethod @ POST And finally how do I add a set of json..

iPhone - Backgrounding to poll for events

http://stackoverflow.com/questions/4656214/iphone-backgrounding-to-poll-for-events

dispatch_get_global_queue DISPATCH_QUEUE_PRIORITY_DEFAULT 0 ^ you can do sth. here or simply do nothing All your background treads and timers are still being executed while background self doSomething.. sleep 1 After your app has timed out the VoIP expirationHandler will be called where you simply restart a long running task. This task will be terminated after 600 seconds. But there will be again..

UIImage: Resize, then Crop

http://stackoverflow.com/questions/603907/uiimage-resize-then-crop

literally days now and even though I feel constantly that I am right on the edge of revelation I simply cannot achieve my goal. I thought ahead of time in the conceptual phases of my design that it would..

How do I create delegates in Objective-C?

http://stackoverflow.com/questions/626898/how-do-i-create-delegates-in-objective-c

that has been assigned as a delegate of another. There's no special process for creating them you simply define a class that implements the delegate methods you're interested in. Though with delegates that.. @end You would then use respondsToSelector as described above when calling this method. Delegates simply implement this method and they're done. This method is straight forward and common in Apple's libraries..

What is the best way to deal with the NSDateFormatter locale “feature”?

http://stackoverflow.com/questions/6613110/what-is-the-best-way-to-deal-with-the-nsdateformatter-locale-feature

log in the category version IS getting executed and stops placed in the code are hit so it's not simply a case of the code somehow not getting used. Bounty update Since I haven't gotten any applicable replies.. 07 15 16 35 24.404 DemoApp 214 307 date4 2001 05 05 05 34 56 PM 0000 As you can see the setLocale simply didn't. The locale of the formatter is still en_GB. It appears that there is something strange about..

performSelector may cause a leak because its selector is unknown

http://stackoverflow.com/questions/7017281/performselector-may-cause-a-leak-because-its-selector-is-unknown

Solution The compiler is warning about this for a reason. It's very rare that this warning should simply be ignored and it's easy to work around. Here's how SEL selector NSSelectorFromString @ someMethod IMP.. every Objective C method call . This is handled in the third line the void on the right hand side simply tells the compiler that you know what you're doing and not to generate a warning since the pointer types.. and crash. There are ways to work around this with bridged casting but really it'd be better to simply use the IMP and function pointer methodology above. Since consumed parameters are rarely an issue this..

Dispelling the UIImage imageNamed: FUD

http://stackoverflow.com/questions/924740/dispelling-the-uiimage-imagenamed-fud

and there is no equivaluent that is as easy to use hence people overuse it and get upset when it simply does its job I added a category to UIImage to fix that header omitted Before you waste time editing..

How to make a UITextField move up when keyboard is present

http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present

can scroll and change textboxes for example. I've got it working where I change the frame size of the UIScrollView when the keyboard goes up and down. I'm simply using void textFieldDidBeginEditing UITextField textField Keyboard becomes visible scrollView.frame CGRectMake scrollView.frame.origin.x scrollView.frame.origin.y..

iOS 6 apps - how to deal with iPhone 5 screen size? [duplicate]

http://stackoverflow.com/questions/12396545/ios-6-apps-how-to-deal-with-iphone-5-screen-size

in the vertically stretched screen from what I could tell in today's presentation. They will be letterboxed or basically the extra 88 points in height would simply be black. If you only plan to support iOS 6 then definitely consider using Auto Layout. It removes all fixed layout handling and instead uses constraints to lay.. you have to support older iOS's then it really depends on your application. A majority of applications that use a standard navigation bar and or tab bar could simply expand the content in the middle to use up that extra points. Set the autoresizing mask of the center content to expand in both directions. view.autoresizingMask..

How to detect iPhone 5 (widescreen devices)?

http://stackoverflow.com/questions/12446990/how-to-detect-iphone-5-widescreen-devices

website if you can access to it. Edit As iOS 6 is now out check the new AutoLayout capabilities. That said if you really need to detect the iPhone 5 you can simply rely on the screen size . UIScreen mainScreen bounds .size.height The iPhone 5's screen has a height of 568. You can imagine a macro to simplify all of this #define..

How do I detect when someone shakes an iPhone?

http://stackoverflow.com/questions/150446/how-do-i-detect-when-someone-shakes-an-iphone

withEvent event BOOL canBecomeFirstResponder return YES @end You can easily transform any UIView even system views into a view that can get the shake event simply by subclassing the view with only these methods and then selecting this new type instead of the base type in IB or using it when allocating a view . In the view..

Remove HTML Tags from an NSString on the iPhone

http://stackoverflow.com/questions/277055/remove-html-tags-from-an-nsstring-on-the-iphone

edge cases and malformed HTML documents for me to feel comfortable using regex or NSScanner. Does anyone have a solution to this One suggestion has been to simply look for opening and closing tag characters this method won't work except for very trivial cases. For example these cases from the Perl Cookbook chapter on the..

How do I apply a perspective transform to a UIView?

http://stackoverflow.com/questions/347721/how-do-i-apply-a-perspective-transform-to-a-uiview

Build fat static library (device + simulator) using Xcode and SDK 4+

http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4

machine he should be using BUILT_PRODUCTS_DIR and or BUILD_DIR instead of guesstimating them Apple's latest Xcode prevents you from doing what he's done it simply will not work due to the Documented change in how Xcode processes targets Another SO questioner asked how to do it WITHOUT xcode and with responses that focussed..

How to send json data in the Http request using NSURLRequest

http://stackoverflow.com/questions/4456966/how-to-send-json-data-in-the-http-request-using-nsurlrequest

the UI thread while the app is waiting for the response My second question is how might I modify the request part of this to do a POST instead of GET Is it simply to modify the HttpMethod like so request setHTTPMethod @ POST And finally how do I add a set of json data to this post as a simple string for example magic real..

iPhone - Backgrounding to poll for events

http://stackoverflow.com/questions/4656214/iphone-backgrounding-to-poll-for-events

Start the long running task and return immediately. dispatch_async dispatch_get_global_queue DISPATCH_QUEUE_PRIORITY_DEFAULT 0 ^ you can do sth. here or simply do nothing All your background treads and timers are still being executed while background self doSomething This is where you can do your X minutes in seconds here.. sharedApplication .backgroundTimeRemaining self doSomething sleep 1 After your app has timed out the VoIP expirationHandler will be called where you simply restart a long running task. This task will be terminated after 600 seconds. But there will be again a call to the expiration handler which starts another long..

UIImage: Resize, then Crop

http://stackoverflow.com/questions/603907/uiimage-resize-then-crop

Resize then Crop I've been bashing my face into this one for literally days now and even though I feel constantly that I am right on the edge of revelation I simply cannot achieve my goal. I thought ahead of time in the conceptual phases of my design that it would be a trivial matter to grab a image from the iPhone's camera..

How do I create delegates in Objective-C?

http://stackoverflow.com/questions/626898/how-do-i-create-delegates-in-objective-c

this question An Objective C delegate is just an object that has been assigned as a delegate of another. There's no special process for creating them you simply define a class that implements the delegate methods you're interested in. Though with delegates that use a formal protocol you must declare your delegate to implement.. NSNotification notification ... other methods here @end You would then use respondsToSelector as described above when calling this method. Delegates simply implement this method and they're done. This method is straight forward and common in Apple's libraries but new code should use the more modern approach below...

What is the best way to deal with the NSDateFormatter locale “feature”?

http://stackoverflow.com/questions/6613110/what-is-the-best-way-to-deal-with-the-nsdateformatter-locale-feature

and I judge the category version to be wrong. Note that the log in the category version IS getting executed and stops placed in the code are hit so it's not simply a case of the code somehow not getting used. Bounty update Since I haven't gotten any applicable replies yet I'll extend the bounty deadline for another day or.. null 2011 07 15 16 35 24.390 DemoApp 214 307 date3 null 2011 07 15 16 35 24.404 DemoApp 214 307 date4 2001 05 05 05 34 56 PM 0000 As you can see the setLocale simply didn't. The locale of the formatter is still en_GB. It appears that there is something strange about an init method in a category. Final answer See the accepted..

performSelector may cause a leak because its selector is unknown

http://stackoverflow.com/questions/7017281/performselector-may-cause-a-leak-because-its-selector-is-unknown

c ios automatic ref counting share improve this question Solution The compiler is warning about this for a reason. It's very rare that this warning should simply be ignored and it's easy to work around. Here's how SEL selector NSSelectorFromString @ someMethod IMP imp _controller methodForSelector selector void func id SEL.. including the two implicit hidden arguments self and _cmd of every Objective C method call . This is handled in the third line the void on the right hand side simply tells the compiler that you know what you're doing and not to generate a warning since the pointer types don't match . Finally you call the function pointer. Complex.. you'll probably eventually send a message to a zombie and crash. There are ways to work around this with bridged casting but really it'd be better to simply use the IMP and function pointer methodology above. Since consumed parameters are rarely an issue this isn't likely to come up. Static Selectors Interestingly the..

Dispelling the UIImage imageNamed: FUD

http://stackoverflow.com/questions/924740/dispelling-the-uiimage-imagenamed-fud

but it is an optimisation tool. Sadly it is badly named and there is no equivaluent that is as easy to use hence people overuse it and get upset when it simply does its job I added a category to UIImage to fix that header omitted Before you waste time editing this please remember that a semi colon at the end of a method..

How to make a UITextField move up when keyboard is present

http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present

example. I've got it working where I change the frame size of the UIScrollView when the keyboard goes up and down. I'm simply using void textFieldDidBeginEditing UITextField textField Keyboard becomes visible scrollView.frame CGRectMake scrollView.frame.origin.x..

iOS 6 apps - how to deal with iPhone 5 screen size? [duplicate]

http://stackoverflow.com/questions/12396545/ios-6-apps-how-to-deal-with-iphone-5-screen-size

what I could tell in today's presentation. They will be letterboxed or basically the extra 88 points in height would simply be black. If you only plan to support iOS 6 then definitely consider using Auto Layout. It removes all fixed layout handling.. really depends on your application. A majority of applications that use a standard navigation bar and or tab bar could simply expand the content in the middle to use up that extra points. Set the autoresizing mask of the center content to expand..

How to detect iPhone 5 (widescreen devices)?

http://stackoverflow.com/questions/12446990/how-to-detect-iphone-5-widescreen-devices

As iOS 6 is now out check the new AutoLayout capabilities. That said if you really need to detect the iPhone 5 you can simply rely on the screen size . UIScreen mainScreen bounds .size.height The iPhone 5's screen has a height of 568. You can imagine..

How do I detect when someone shakes an iPhone?

http://stackoverflow.com/questions/150446/how-do-i-detect-when-someone-shakes-an-iphone

return YES @end You can easily transform any UIView even system views into a view that can get the shake event simply by subclassing the view with only these methods and then selecting this new type instead of the base type in IB or using..

Remove HTML Tags from an NSString on the iPhone

http://stackoverflow.com/questions/277055/remove-html-tags-from-an-nsstring-on-the-iphone

for me to feel comfortable using regex or NSScanner. Does anyone have a solution to this One suggestion has been to simply look for opening and closing tag characters this method won't work except for very trivial cases. For example these cases..

How do I apply a perspective transform to a UIView?

http://stackoverflow.com/questions/347721/how-do-i-apply-a-perspective-transform-to-a-uiview

Build fat static library (device + simulator) using Xcode and SDK 4+

http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4

and or BUILD_DIR instead of guesstimating them Apple's latest Xcode prevents you from doing what he's done it simply will not work due to the Documented change in how Xcode processes targets Another SO questioner asked how to do it WITHOUT..

How to send json data in the Http request using NSURLRequest

http://stackoverflow.com/questions/4456966/how-to-send-json-data-in-the-http-request-using-nsurlrequest

for the response My second question is how might I modify the request part of this to do a POST instead of GET Is it simply to modify the HttpMethod like so request setHTTPMethod @ POST And finally how do I add a set of json data to this post as..

iPhone - Backgrounding to poll for events

http://stackoverflow.com/questions/4656214/iphone-backgrounding-to-poll-for-events

immediately. dispatch_async dispatch_get_global_queue DISPATCH_QUEUE_PRIORITY_DEFAULT 0 ^ you can do sth. here or simply do nothing All your background treads and timers are still being executed while background self doSomething This is where.. self doSomething sleep 1 After your app has timed out the VoIP expirationHandler will be called where you simply restart a long running task. This task will be terminated after 600 seconds. But there will be again a call to the expiration..

UIImage: Resize, then Crop

http://stackoverflow.com/questions/603907/uiimage-resize-then-crop

into this one for literally days now and even though I feel constantly that I am right on the edge of revelation I simply cannot achieve my goal. I thought ahead of time in the conceptual phases of my design that it would be a trivial matter..

How do I create delegates in Objective-C?

http://stackoverflow.com/questions/626898/how-do-i-create-delegates-in-objective-c

is just an object that has been assigned as a delegate of another. There's no special process for creating them you simply define a class that implements the delegate methods you're interested in. Though with delegates that use a formal protocol.. other methods here @end You would then use respondsToSelector as described above when calling this method. Delegates simply implement this method and they're done. This method is straight forward and common in Apple's libraries but new code should..

What is the best way to deal with the NSDateFormatter locale “feature”?

http://stackoverflow.com/questions/6613110/what-is-the-best-way-to-deal-with-the-nsdateformatter-locale-feature

wrong. Note that the log in the category version IS getting executed and stops placed in the code are hit so it's not simply a case of the code somehow not getting used. Bounty update Since I haven't gotten any applicable replies yet I'll extend.. 307 date3 null 2011 07 15 16 35 24.404 DemoApp 214 307 date4 2001 05 05 05 34 56 PM 0000 As you can see the setLocale simply didn't. The locale of the formatter is still en_GB. It appears that there is something strange about an init method in a..

performSelector may cause a leak because its selector is unknown

http://stackoverflow.com/questions/7017281/performselector-may-cause-a-leak-because-its-selector-is-unknown

this question Solution The compiler is warning about this for a reason. It's very rare that this warning should simply be ignored and it's easy to work around. Here's how SEL selector NSSelectorFromString @ someMethod IMP imp _controller methodForSelector.. self and _cmd of every Objective C method call . This is handled in the third line the void on the right hand side simply tells the compiler that you know what you're doing and not to generate a warning since the pointer types don't match . Finally.. a message to a zombie and crash. There are ways to work around this with bridged casting but really it'd be better to simply use the IMP and function pointer methodology above. Since consumed parameters are rarely an issue this isn't likely to come..

Dispelling the UIImage imageNamed: FUD

http://stackoverflow.com/questions/924740/dispelling-the-uiimage-imagenamed-fud

it is badly named and there is no equivaluent that is as easy to use hence people overuse it and get upset when it simply does its job I added a category to UIImage to fix that header omitted Before you waste time editing this please remember..

What happens if I don't retain IBOutlet?

http://stackoverflow.com/questions/1250518/what-happens-if-i-dont-retain-iboutlet

to nil is not. My description may have been overly verbose but I didn't want to leave out any details in the scenario. Simply following the guidelines will help avoid problems as you encounter more complex situations. It is additionally worth noting..

How to display a base64 image within a UIImageView?

http://stackoverflow.com/questions/1366837/how-to-display-a-base64-image-within-a-uiimageview

the UIImageView objective c iphone uiimageview uiimage share improve this question You dont have to encode it. Simply make a NSUrl it knows the data url. NSURL url NSURL URLWithString base64String NSData imageData NSData dataWithContentsOfURL..

Crossplatform iPhone / Android code sharing

http://stackoverflow.com/questions/2380258/crossplatform-iphone-android-code-sharing

iPhone Android code sharing Simply put What is the most effective way to share reuse code between iPhone and Android builds The two most common scenarios I..

UITableView issue when using separate delegate/dataSource

http://stackoverflow.com/questions/254354/uitableview-issue-when-using-separate-delegate-datasource

Owner to TableTestTableViewController in the main IB window. No changes are necessary in the UI part of the XIB. Simply having this outlet in place even though no user code directly uses it resolves the problem completely. Thanks to those who've..

URL for sending a user to the app review page on device's app store

http://stackoverflow.com/questions/3374050/url-for-sending-a-user-to-the-app-review-page-on-devices-app-store

app. https userpub.itunes.apple.com WebObjects MZUserPublishing.woa wa addUserReview id 337064413 type Purple Software Simply replace the ID with your app ™s ID to create a URL for your app. On a desktop or laptop this will take you directly to the..

Understanding the memory consumption on iPhone

http://stackoverflow.com/questions/363493/understanding-the-memory-consumption-on-iphone

ES Analyzer and OpenGL ES Driver . You will need to run these on the device as the simulator doesn't use OpenGL. Simply choose Product Profile from XCode and look for these profiles once Instruments launches. Armed with that knowledge here..

Subclassing NSOperation to be concurrent and cancellable

http://stackoverflow.com/questions/3859631/subclassing-nsoperation-to-be-concurrent-and-cancellable

do not need to do anything with isExecuting isCancelled or isFinished . Those are all handled automatically for you. Simply override the main method. It's that easy. A note technically this is not a concurrent NSOperation in the sense that MyOperation..

Adding login screen in front of Cocoa Touch Tab Bar Application for IOS

http://stackoverflow.com/questions/4406426/adding-login-screen-in-front-of-cocoa-touch-tab-bar-application-for-ios

method you'll see this window addSubview tabcontroller.view window makeKeyAndVisible return YES Simply initialize your login view controller and add it after the tabcontroller like this initialScreenViewController InitialScreenViewController..

What's the best way to put a c-struct in an NSArray?

http://stackoverflow.com/questions/4516991/whats-the-best-way-to-put-a-c-struct-in-an-nsarray

own too. I would recommend doing so as the class is probably lighter weight than NSData for simple data structures. Simply use an expression like the following NSValue valueWithBytes p objCType @encode Megapoint And to get the value back out Megapoint..

Business card reader or OCR Library for iPhone SDK

http://stackoverflow.com/questions/4560587/business-card-reader-or-ocr-library-for-iphone-sdk

c xcode ocr iphone share improve this question EXC_BAD_ACCESS He's never instantiating the 'tess' variable. Simply add self startTesseract to the viewDidLoad method in OCRDemoViewController and it will work like a charm. share improve..

adding images to UItableView

http://stackoverflow.com/questions/4999017/adding-images-to-uitableview

improve this question A custom UITableViewCell is not required to simply add an image to the left side of the cell. Simply configure the imageView property of the UITableView cell in your tableView cellForRowAtIndexPath delegate method like so..

How do you explicitly animate a CALayer's backgroundColor?

http://stackoverflow.com/questions/518192/how-do-you-explicitly-animate-a-calayers-backgroundcolor

question You don't need to wrap CGColorRefs when setting the toValue or fromValue properties of a CABasicAnimation. Simply use the CGColorRef. To avoid the compiler warning you can cast the CGColorRef to an id. In my sample app the following code..

Append data to a POST NSUrlRequest

http://stackoverflow.com/questions/6148900/append-data-to-a-post-nsurlrequest

Store orientation to an array - and compare

http://stackoverflow.com/questions/6368618/store-orientation-to-an-array-and-compare

and page 364. The above linked paper has further details too. I just noticed you are using yaw pitch and roll. Simply put don't and another reason not to . Can you use the accelerometer data instead An accelerometer is a direct measurement..

What exactly does delegate do in xcode ios project?

http://stackoverflow.com/questions/7215698/what-exactly-does-delegate-do-in-xcode-ios-project

understand conceptually so getting your head around how to think about it ahead of the technical details is important. Simply put a delegate is a callback. Two main scenarios to use delegates A class or control wants to abstract out the details on..

SFHFKeychainUtils. iOS keychain. ARC compatible

http://stackoverflow.com/questions/7663443/sfhfkeychainutils-ios-keychain-arc-compatible

NSError errorWithDomain SFHFKeychainUtilsErrorDomain code 1999 userInfo nil else Something else went wrong. Simply return the normal Keychain API error code. if error nil error NSError errorWithDomain SFHFKeychainUtilsErrorDomain code..

Most efficient way to draw part of an image in iOS

http://stackoverflow.com/questions/8035673/most-efficient-way-to-draw-part-of-an-image-in-ios

seems to be for CPU. So it seems to be done in CPU. Graphics operations done in CPU are a lot slower than in GPU. Simply clipping an image and compositing the image layers are very simple and cheap operations for GPU compared to CPU soo you..

How to capture current view screenshot and reuse in code? (iPhone SDK)

http://stackoverflow.com/questions/879064/how-to-capture-current-view-screenshot-and-reuse-in-code-iphone-sdk

rotation the default animation provided by UIKit rotating the currently displayed view is inappropriate conceptually. Simply disabling the animation and swapping the views suddenly is tolerable but is far below the polish I'm building into the rest..

Mobile development - Native VS Cross Platform VS JavaScript [closed]

http://stackoverflow.com/questions/8865277/mobile-development-native-vs-cross-platform-vs-javascript

and BlackBerry. Candidates After conducting some background research I found the following possible candidates Native Simply but laboriously develop for each platform with its native tools and language. HTML5 CSS and JavaScript Could be a web service..

Availability.h, UIKit.h, etc not found

http://stackoverflow.com/questions/9380186/availability-h-uikit-h-etc-not-found

solution Go to Build Phases Link Binary With Liibraries. If you are having a problem with say Foundation.framework. Simply delete that one i.e. use the minus button at the bottom of the list. And then add it again using the plus button. Clean..