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

Why is the sound not working?
I added one mp3 file in my main bundle and updated your code as follows. I hope it will work with the url you have used as well // // ViewController.swift // MinecraftSoundApp // // Created by Abdel Rahman Osman on 11/18/14. // Copyright (c) 2014 Abdel Rahman Osman. All rights reserved. // import UIKit import AVFoundation class ViewController: UIViewController { var audioPlayer = A

Categories : IOS

UIToolBar under navigationBar without toolbar moving on scroll
Don't use a table view controller. Use a simple view controller which has an explicit outlet to a table view which is a sub view. Then you can also have a sub view which is the toolbar above the table view (and anything else you might need above or below the table in future). Alternatively you can set the tableHeaderView (and tableFooterView) of the table view itself.

Categories : IOS

iOS AdMob ads not showing up unless on Test Device
Have you registered an account with AdMob? If so, have you replaced the test Ad Unit ID that's included in the quick start with your own? If not, that would explain the behavior you're seeing (the ID in the example is only for test ads, and won't serve real ones). An Ad Unit ID identifies an ad placement within your app, and is unique to you. The AdMob instructions for generating one are in th

Categories : IOS

iOS: Archive Path containing a date
Use NSFileManager to get the paths of all files in your archive folder. Depending on how you archive you'll then have one file name that you can use or a list of files (dates) that you can show to your user.

Categories : IOS

Store NSHttpCookie in iOS Keychain Using Swift
You should checkout SSKeychain: https://github.com/soffes/sskeychain. It has a really nice and usable interface over the keychain API's. It's not Swift per se, but you should still be able to use it in a swift app. I don't think there's a way to store objects themselves, but as you mentioned you can serialize the cookie into a string and save it in the keychain. Example below for how it could be

Categories : IOS

Connecting to multiple iBeacons at once
I think that if they're all transmitting the same region (i.e. they all have the same proximity UUID) then CoreLocation won't keep sending the didEnterRegion and didExitRegion methods. Once you start ranging for a region (that's a mouthful) the locationManager:didRangeBeacons:inRegion: method gets called repeatedly, which is where you can get the details of the connected beacons.

Categories : IOS

How to implement tintcolor behaviour for UIButtonTypeCustom
you could create an array of colors using UIColor within your class then access them individually have you tried it that way? ok as an example something like this UIBarButtonItem.appearance().tintColor = UIColor.yellowColor() ideally can you post your class code aswell

Categories : IOS

Importing web service with Core Data or SQLite or something else?
“Best” is subjective. As I understand it, Core Data uses SQLite under the covers, so it's really more a matter of what you're comfortable with. Have you used Core Data before? If so, use that. Have you used an SQL Database before? if so, use SQLite. If you're starting from square one, I supposed I'd recommend Core Data. Here are a few links to get you started: Data Management in iOS b

Categories : IOS

iOS Test crashes with waitForExpectationsWithTimeout
I had the same issue. The fix for me appeared to be increasing the timeout interval. I originally had a timeout interval of 1 and increased it to 5 just to be on the safe side. Appears to be working fine now. I'm not sure how long your async call takes, or if you can afford a longer timeout interval than 1, but it's worth a shot.

Categories : IOS

UINavigationController overlapping the ViewController content
You probably want to check the value of your view controller's edgesForExtendedLayout property, and that the extendedLayoutIncludesOpaqueBars property is set to true (because your navigation bar looks to be opaque). Assuming you're using Swift it can be achieved like so: // This is the default value of edgesForExtendedLayout controller.edgesForExtendedLayout = .All; // The default for this is f

Categories : IOS

UITableViewCell resize to fit detail text
You Can do it :- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifire = @"CellIdentifire"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifire]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdenti

Categories : IOS

MDM profile installation failed in iOS sdk
Can you try to access your webserver from mobile Safari? In the case, if it will show you a dialog that website isn't trusted then you didn't install a certificate for your webserver to trusted CA storage. You will need to Create a config profile (usnig IPCU) Choose "Credentials" Add you certificate Install it on a device

Categories : IOS

Swift, creating a Generic UIViewController
As mentioned in OP comments, Generic class cannot be properly represented in Objective-C. The workaround would be using the class as a property. something like this: class MyClass: UIViewController{ let viewCls:UIView.Type init(viewCls:UIView.Type = UIView.self) { self.viewCls = viewCls super.init(nibName: nil, bundle: nil); } required init(coder aDecoder: NSCo

Categories : IOS

Using iOS 8 features on iOS 7 phones, hidesBarsOnSwipe
It will crash on iOS 7 because UINavigationController doesn't respond to setHidesBarOnSwipe: selector (the method is implemented only on iOS 8 or newer). You can add a safety check: if([nc respondsToSelector:@selector(setHidesBarOnSwipe:)]) { ns.hidesBarOnSwipe = YES; } else { // use your old hack if you want to }

Categories : IOS

List of connected devices to local wifi network
One way to realize this is pinging all IP addresses in your WLAN. If you get response from an IP address, you find a neighbour. It's simple but slow, and may miss the device which refuse to respond to ping.

Categories : IOS

iOS 8 UIImagePickerController to take photos only photos
https://developer.apple.com/library/ios/documentation/uikit/reference/uiimagepickercontroller_class/index.html#//apple_ref/c/tdef/UIImagePickerControllerCameraCaptureMode cameraUI.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;

Categories : IOS

IOS remote silent notification is not working during phone calls / network fluctuation
I believe just because you are sending a silent notification, doesn't mean that the application will get notified straight away. From my observations using a GSM iPhone. Whenever I am on a Phone Call the Cellular Data type drops a band e.g. LTE -> 3G, 3G -> EDGE etc. So the data network is not reliable. You also state that it does not happen during network fluctuation, the system has recieved th

Categories : IOS

Swift - Get last 7 days starting from today in array
It's might not be the fastest code. But you get the idea :) import Foundation let lastSevenDay: [Int] = { var days = [Int]() let secondsInADay: NSTimeInterval = 24 * 60 * 60 let now = NSDate() let calendar = NSCalendar(calendarIdentifier: NSGregorianCalendar)! for i in 1...7 { let theDate = now.dateByAddingTimeInterval(-secondsInADay * NSTimeInterval(7 - i)) l

Categories : IOS

iOS : Unable to import CoreWLAN framework in iOS8
Since this question is tagged with the iOS tag, you're presumably trying to import CoreWLAN for an iOS project, which isn't possible. You can use the SystemConfiguration framework if all you're trying to do is access the name of the currently connected network. See the Apple Documentation for more.

Categories : IOS

how to move Text Field above my toolbar which is added above key board
Create an instance variable for the height of the keyboard accessory view (e.g. float accessoryViewHeight), and set it when the accessory view is created. Then, in the code you posted, use the kbSize + the accessoryViewHeight in place of kbSize.height. Example: ... CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size; float totalKBHeight = kbSize.height + acces

Categories : IOS

collectionView:cellForItemAtIndexPath: why my view has zero subviews?
I try to simulate a similar project and I had the same issue (my prototype cell wasn't used). Be sure that you don't have any self.collectionView.registerClass(UICollectionViewCell, forCellWithReuseIdentifier: reuseIdentifier) or self.collectionView.registerClass(DataItemCollectionViewCell, forCellWithReuseIdentifier: "DataItemCell"DataItemCollectionViewCell) anywhere in your code.

Categories : IOS

Getting statistics for app functions usage
Select your log file uploaded --> Search for a particular even from the search bar --> you will see all the listed event logs --> Now click on the Arrow next to any one of these logs --> Select event actions --> Extract fields. Now in the Example values for a Field section put few of your function names and click generate. Splunk will understand your requirements and list all the logs associated w

Categories : IOS

Swift, return value from asynchronous block
Your Swift class User needs to implement the Printable protocol so that it can be used by println. Something like this: Class User: Printable { let name = "Bob" var description: String { return "User: (name)" } } Read more in this Apple post If you are feeling lazy, make your User class a subclass of NSObject which already implements the Printable protocol Edit A quick search of

Categories : IOS

Xamarin change page from a renderer Button
A nice way to do this would be to combine your custom renderer with a custom button view. Your custom view could have a swipe event to which you can subscribe. Of course, you could create a custom delegate if necessary as well, to pass custom event data, but I've kept this example simple. public class CustomButton : Button { public event EventHandler OnSwipeUp; public void FireSwipeUp()

Categories : IOS

iOS: How to find the latest auto-renew/purchase info from the in-app purchase receipt
Hi, Finally i found the answer. Actually, you need to parse the entire receipt which was received from apple's itunes server and from that you can know the latest purchased receipt by comparing the previous purchased receipt expire time and the next purchased receipt expire time. You need to do this until you reach end of receipt.

Categories : IOS

Can data model be changed in CloudKit after App is in App Store and Container is in production mode?
During development, you can make any changes you need. When you deploy to the Production environment, Apple warns you: After the schema is deployed, you won't be able to remove Production types or attributes in Development. So you can add types and attributes, you just can't remove them. You can also add and remove indexes.

Categories : IOS

Transition between different points of views (SCNCameras) in SceneView
changing the pointOfView of the view is the easiest way. But if you want to control the path you will have to move the camera yourself. You can do that with SCNAction or by using CoreAnimation explicit or implicit animations.

Categories : IOS

How do I extend a NSManagedObject to contain MKAnnotation in Swift?
You cannot have stored properties, but you can have calculated properties! I.e: var coordinate : CLLocationCoordinate2D { get { return CLLocationCoordinate2D(latitude: 10.0, longitude: 10.0) } }

Categories : IOS

Sorting of a UITableView with custom Objects
You should implement compare: method in your Person class and then call this method on the array holding the data: NSArray * sortedPersonArray = [personArray sortedArrayUsingSelector:@selector(compare:)]; Regarding the compare: implementation: - (NSComparisonResult)compare:(Person *)person{ if (self.Age > person.Age) { return NSOrderedDescending; }else if(self.Age < perso

Categories : IOS

Core Data adding new ViewController (Lynda tutorial)
If you want to change the initial view controller just import that view controller and create the instance of the view controller and replace it with the PersonTableTableViewController instance. Lets say you want to have PersonListTableViewController as initial view controller then you can initialise like this, go to the storyboard and replace the navigationcontroller's rootviewcontroller to Perso

Categories : IOS




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