w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
  Home » IOS » Page 1
constraints problems with containers
In your main view controller, declare the following override: - (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; // Layout the container's content and get its resulting size [self.containedViewController.view layoutIfNeeded]; CGSize containedViewSize = [self.containedViewController contentSize]; // Now, use containedViewSize to set constraints on the view control

Categories : IOS

Hide time and battery status
Starting with iOS 8 the status bar gets its color from the view controller of the top most view that is currently visible. Try setting the following on the Navigation Controller (assuming the UINavigationController view is the top most view): <navController>.navigationBar.barStyle = UIBarStyleBlack; If that doesn't work try adding the override to the top level UIViewController as you did

Categories : IOS

Merge two objects of same type
I noticed that Mantle has the following function which I was able to use: mergeValueForKey:fromModel: So in my device model, I added two functions: mergeConfigInfoKeysFromModel: mergeStatusInfoKeysFromModel: These functions have access to an array that contains NSString values representing the properties/keys. There is one array for the configInfo and another for statusInfo properties/keys.

Categories : IOS

Navigation structure without using standard Apple Navigation Bars (Swift)
In IB you can change the class for the navigation bar to your own class. If you don't use IB you can use [[UINavigationController alloc] initWithNavigationBarClass:[MyNavBar class] toolbarClass:nil]

Categories : IOS

iOS Swift 'message sent to deallocated instance' with notification
The object has been deallocated. You need to remove yourself as an observer in deinit: deinit { NSNotificationCenter.defaultCenter().removeObserver(self) }

Categories : IOS

iOS, swift: play background music and sound effects without delay
You could using AVPlayer to play your sound file. Keep one player, but change its AVPlayerItem to a new item when you need to play a new sound. It might be faster than recreating the player every time. While AVAudioPlayer/AVPlayer is the simplest option, it will not give you the shortest delay or perfect synchronization when playing audio files. You should look into Audio Queues or Audio Units

Categories : IOS

UICollectionView: Is there a way to reload only the supplementary views?
To reload supplementary views you can use -invalidateLayoutWithContext:. See documentation for UICollectionViewLayoutInvalidationContext and method -invalidateSupplementaryElementsOfKind:atIndexPaths: (available from iOS 8).

Categories : IOS

Open a existing app from own app ios
If the app you want to open has defined a custom scheme, you can open it directly by calling openURL: with a URL that starts with that scheme. In your code it would look like: if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString: @"theAppsCustomScheme://xxx"]]) { [[UIApplication sharedApplication] openURL:[NSURL URLWithStrin

Categories : IOS

Deleting NSManagedObject subclass not nullifying it's many-to-many relationship
In core data, apart from the type of relationship(one to one, many to many etc.), you can also set the delete rule. For example, if there is a relationship like this A --->B (one to one) B --->> A (one to many) You can set a delete rule i.e. what happens to the instances of B when A is deleted. This post on Stackoverflow talks about delete rules in detail.

Categories : IOS




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