w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
  Home » IOS » Page 5
Pass Image from UITabBarController to subview (Swift)
Your tab bar controller has viewControllers property. Just iterate through it check which controller is kind of class you need. func passImage(passedImage: UIImage) { if viewControllers!.isEmpty{ return } for index in 0...viewControllers!.count{ if let controller = viewControllers[index] as? DesignerTabController controller.pickedImageView.image = passedImage } }

Categories : IOS

how to open file and append a string in it, swift
Check the reading part. The method cotentsOfFile: is a method of NSString class. And you have use it wrong way. So replace this line let text2 = String(contentsOfFile: path, encoding: NSUTF8StringEncoding, error: nil) Here you have to use NSString instead of String class. let text2 = NSString(contentsOfFile: path, encoding: NSUTF8StringEncoding, error: nil)

Categories : IOS

Document Folder for iOS 8.1 SDK
To find your app's document folder, you can simply put this into your application:didFinishLaunchingWithOptions: and you will see the path in your xcode's console window: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSLog(@"Documents Directory: %@", [paths objectAtIndex:0]);

Categories : IOS

iOS NSDateFormatter returns null
Turns out it was my date format. This work for me. NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.ZZZZ"]; NSDate *dateFromApi = [dateFormatter dateFromString:@"0001-01-03T00:00:00+02:00"];

Categories : IOS

How do I use TouchID in landscape mode?
The App Store app does rotate the Touch ID alert but it seems to be a hack. As you rotate the device (I tried using a 6+), you see the grey alpha mask rotate along with the Touch ID alert. They may be applying a transform on the view but I have not figured out how to get to that view yet. The XCode UI inspector does not show the Touch ID dialog in your view hierarchy at runtime. Understandably a

Categories : IOS

Parse Error (Code: 102) shows up for some of my queries starting today (11/17/2014)
Parse team were able to reproduce and are investigating the issue. It's occurring for a certain number of apps. Here's the link for the bug: https://developers.facebook.com/bugs/795944720463330/

Categories : IOS

How to play video player one after another in ios?
You should be able to use this notification: https://developer.apple.com/LIBRARY/IOS/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/index.html#//apple_ref/c/data/MPMoviePlayerPlaybackDidFinishNotification And then look for this constant PlaybackEnded: https://developer.apple.com/LIBRARY/IOS/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/index.html#//apple_r

Categories : IOS

how to get keyboard height for portrait and landscape in IPhone and IPad
You can find Height of keyboard using following code. // Works in both portrait and landscape mode CGRect kbRect = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue]; kbRect = [self.view convertRect:kbRect toView:nil]; CGSize kbSize = kbRect.size; NSLog(@"Keyboard Height: %f Width: %f", kbSize.height, kbSize.width);

Categories : IOS

Does entities in Core Data persist their state whether save is called or not on managed context iOS?
This is how core data works. Think of the managed object context as an in-memory scratchpad for any changes you're making. When you change your objects, that change is "real" for as long as you are using that context. If you save the context, those changes are written up to the next level, which is either a parent context, or your persistent store on disk. If you destroy the context without

Categories : IOS

Listing Available networks in ios using IBM Worklight
Try this, It will give the currently connected network but not the list of available networks. Apple not supporting that. NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces(); NSLog(@"%s: Supported interfaces: %@", __func__, ifs); id info = nil; for (NSString *ifnam in ifs) { info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);

Categories : IOS

How to crop center part of large image in iOS?
Calculate crop rect from image float imgHeight = 100.0f; //Any according to requirement float imgWidth = 100.0f; //Any according to requirement CGSize cropRect = CGSizeMake((largeImage.size.width/2)-(imgWidth/2),largeImage.size.height/2)-(imgHeight/2),imgWidth,imgHeight); Now crop it CGImageRef imageRef = CGImageCreateWithImageInRect([largeImage CGImage], cropRect); // or use the UIImage where

Categories : IOS

UIActionsheet displaying in iPhone but not in iPad
First of all, UIActionSheet existed before UIPopoverController and UIPopoverController isn't available on iPhone, so it's useful for backwards compatibility and universal apps. Also, a UIActionSheet isn't necessarily presented in a popover, specifically, if you show it from a UIBarButtonItem or UIToolbar that is already inside a popover. It is then presented in a similar fashion as on the iPhone

Categories : IOS

ScrollView issue on AutoLayout ( Xcode 6)
You should add your textfield to scrollview with "horizontal centre in container". That means how much your scrollview width is increase/decrease your textfield will remain in centre with its leading and trailing constraint constant. So it will adjust its width as per scrollview width.

Categories : IOS

How can I change the track for the freeway drive in simulator?
Hi sid Please follow this Screenshots To change Simulator debug mode To give your location longitude and latitude which you get from google maps

Categories : IOS

How to implement iAd correctly
Add the iAd Framework to your build libraries. Include this in your .h file #import <iAd/iAd.h> Include this in viewDidLoad of .m file. self.canDisplayBannerAds = YES;

Categories : IOS

Document Or cache Path Changes on every launch in iOS 8
The path to the application container or sandbox changing should be an expected condition. You should not store the absolute filesystem path to a sandbox directory; instead store the path relative to that directory, and append that to the result of NSSearchPathForDirectoriesInDomains each time.

Categories : IOS

What is wrong with this NSLocalizableString code?
The syntax of NSLocalizedString goes like the below. NSString * NSLocalizedString( NSString *key, NSString *comment ) The key should be used in your .strings file. The value of the key will be different for different languages . So when you run the key will be replaced by the value provided in the language .strings file you set. Look at this tutorial for more explanation.

Categories : IOS

Create and place a UILabel to fix my text with a dynamic height
Try this, UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 35)];//set the correct width here NSString *text = @"A string of x letters of text goes here"; label.text = text; CGSize constrainedSize = CGSizeMake(label.frame.size.width , 9999); //TODO:change the font properties to yourown NSDictionary *attributesDictionary = [NSDictionary dictionaryWithObjectsAndKeys:

Categories : IOS

How to use Asihttprequest asynchronous requests server? Beginners want a detailed explanation thank you
Try this, #import <CommonCrypto/CommonDigest.h> NSString *md5(NSString *str) { const char *cStr = [str UTF8String]; unsigned char result[CC_MD5_DIGEST_LENGTH]; CC_MD5( cStr, strlen(cStr), result ); return [NSString stringWithFormat:@"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", result[0], result[1], result[2], result[3],

Categories : IOS

how to save camera capture images in nsuserdefaults in ios
You can save UIImage object to NSUserDefault.Using NSCache instead to save image,will help to use memory effectively. Check this thread

Categories : IOS

UIBarButtonItem action doesn't trigger on tap
Looks like your toolbar frame is (0,0,0,0) so your button is shown but doesn't respond to user interactions. Try something like this: var genderToolbar = UIToolbar(frame: CGRect(x: 0, y: 0, width: 320, height: 44))

Categories : IOS

Switching between UITableView and MapView with same data source
u can easily achieve this by using a view there is no need for using a separate view controller, for this u need a view controller instead of tableviewcontroller for example see the image, on top of tableview, so lets do like this, in your view controller contains tableview, add a separate view which contains your map view and back button as seen below image in the View-MapView should be on top

Categories : IOS

Add a uiview programmatically between two textfields which was created on xib with autolayout
1> save constraints on some variable before removing it 2> remove your view in between 2 text fields 3> apply that saved constraints again on pathView 4> call [pathView setNeedsDisplay]

Categories : IOS

Is there anything that can be done to improve reliability on Apple Push Notifications?
Apple's servers for uses I have seen, have been extremely reliable (along the 99.9% lines). If you are having delivery issues, the real question is - how are you sending the push notifications to Apple's servers? It's easy for the server on your end to drop requests, or not be able to handle throughput - also possible with third party services that send notifications for you. Also possible is m

Categories : IOS

Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0xb06b9940)
EXC_BREAKPOINT is a common source of confusion... This is the exception that the lower layers of Mach reports when it hits a certain trap instruction. That trap instruction is used by lldb to implement breakpoints, but it is also used as an alternative to "assert" in various bits of system software. However, lldb will never show you EXC_BREAKPOINT as the stop reason if the trap was one that lld

Categories : IOS

Update a UI from Background thread when app is also in Background to show Splash Screen on next resume
Springboard does not update your app's snapshot[1] when all background tasks have expire/ended. IIRC when your application is in the background, the snapshot is only updated just before your app is suspended after handling these background events: Background Fetch/Refresh Remote Notification (I don't recall the third one. Background Download maybe?) [1] The image that appears in the task swi

Categories : IOS

find the extended file type of a specified file ( JPEG image, TIFF Image, ...) objective c
Once you have a UIImage you no longer have any concept of an image type. If you read encoded image data from a file (or other source) into an NSData object you can inspect the data to determine the image's type. But once you have a UIImage you have an abstract image bitmap that has no type. Remember, a UIImage can be created in memory. It never started out as a file and it never had a specific t

Categories : IOS

Added a drop down triangle to my UIButton with a subclass, how can I prevent it from stretching when I change the title?
class DropDownButton: UIButton { override func awakeFromNib() { super.awakeFromNib() setImage(UIImage(named: "drop-down-triangle"), forState: .Normal) sizeToFit() titleEdgeInsets = UIEdgeInsets(top: 0, left: -imageRectForContentRect(bounds).width - 17.0, bottom: 0, right: 0) imageEdgeInsets = UIEdgeInsets(top: 0, left: **static value here**, bottom

Categories : IOS

Using Custom Keyboard in iOS app
You should use the iOS8 custom keyboards API: https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Keyboard.html

Categories : IOS

iOS - Facebook - You must upgrade this app to Graph API v2.x
It's all in the docs. Have a look at https://developers.facebook.com/docs/apps/changelog https://developers.facebook.com/docs/apps/upgrading#v1tov2 https://developers.facebook.com/docs/ios/upgrading#313to314 https://developers.facebook.com/docs/reference/ios/current/class/FBRequest/#overrideVersionPartWith:

Categories : IOS

UIImageView+animatedGIF struck to animation
Try this: + (UIImage *)animatedImageWithAnimatedGIFData:(NSData *)data duration:(NSTimeInterval)duration { return animatedImageWithAnimatedGIFReleasingImageSource(CGImageSourceCreateWithData(toCF data, NULL)); } static UIImage *animatedImageWithAnimatedGIFReleasingImageSource(CGImageSourceRef source) { UIImage *image = animatedImageWithAnimatedGIFImageSource(source); CFRelease(sourc

Categories : IOS

touches not recognized on tableview when contentOffset set to a negative value
It might be easier to just add 30.0f to contentInset.top so that you can continue to use a stock table view. If you still want use the approach you outlined, you need to override hitTest:withEvent: in a UITableView subclass: - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { if (CGRectContainsPoint(self.theViewInQuestion.frame, point)) { return self.theViewInQuestion;

Categories : IOS

How do I set .mp4 image
To be clear, you're not setting "the background image" of an audio file. You're editing the metadata of it (thanks for clarifying in the comments). You can use a library such as MP4Audio to do this without having to write the logic yourself: To set the metadata for an audio file: ANMovie* file = [[ANMovie alloc] initWithFile:@"test.m4a"]; // or .mp4 NSData* jpegCover = UIImageJPEGRepresentation

Categories : IOS

checking to see if location in scene is occupied by sprite
There are a few methods which can help you in this regard: (BOOL) intersectsNode: (SKNode*)node, available with SKNode, and CGRectContainsPoint() as well as the CGRectContainsRect() methods. For instance the loop to check for intersection can look as follows: var point: CGPoint var exit:Bool = false while (!exit) { let posX = random(min: 50, max: 270) let posY = random(min: 50, max:

Categories : IOS

how to removed dimmed effect of disabled TabBarItem IOS
try this... wright this code in you app delegate.this may help... [[UITabBar appearance] setBackgroundImage:[[UIImage alloc] init]]; [[UITabBar appearance] setShadowImage:[[UIImage alloc] init]];

Categories : IOS

How to change variable within SKAction sequence?
if you run the action with a tag then you can override it at any time: func updateActionForDuration(duration:NSTimeInterval) { self.runAction( SKAction.repeatActionForever(SKAction.sequence( [SKAction.runBlock(chainsawDropper), SKAction.waitForDuration(duration)])), withKey: "action key") }

Categories : IOS

NSUserDefaults or a backend?
Yes, you can store data in NSUserDefaults, which will be the quick and dirty method to store data locally. You could use Core Data, though I prefer to just use FMDB and write my own SQLite statements. You could also use NSFileManager and just read and write everything to a JSON file. Parse will probably be overkill if all you are doing is storing a list of check list objects.

Categories : IOS

NSLocalization + Storyboard using Swift
When you set the label on your button, Auto Layout runs and sets the frame of your bar back to its initial value. When Auto Layout is enabled, you shouldn't adjust frame sizes. Instead, you should use size constraints like so: Add an Auto Layout constraint on your bar that sets its width. To do this, select your bar view in Interface Builder and click the Auto Layout Pin icon |-[]-|, click the

Categories : IOS

How to incorporate textfield change notification into textFieldDidEndEditing
Try this. Add the delegate method -(void)textFieldDidBeginEditing:(UITextField *)textField. And in this method do something like: -(void)textFieldDidBeginEditing:(UITextField *)textField { self.textBeforeEditing = textField.text; } And then, do a compare when textFieldDidEndEditing is invoked: -(void) textFieldDidEndEditing:(UITextField *)textField { ... if(![self.textBeforeEditing

Categories : IOS




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.