iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

Loading NSData into a UIWebView

In my web browser, I am trying to load a UIWebView with NSData obtained from a NSURLConnection. When I try to load it into the UIWebView, instead of the site, it comes up with the HTML plain text. Here is my code: in viewDidLoad: NSURLRequest *request = [NSURLRequest requestWithURL: [NSURL URLWithString:@”http://www.msn.com”]]; [NSURLConnection connectionWithRequest: request delegate:self]; […]

iOS Search Results Order

I have a UISearchBar that searches a table of data. When a search is typed in, the results are displayed in an order like so: Starts typing ‘ch…’ 1. Ache 2. Cherries 3. Choice It makes more sense to me (and for my app) that ‘Cherries’ and ‘Choice’ would be at the top of the […]

How to Check if Parallax is enabled

I am making a wallpaper app and would like to check if a user has parallax enabled on his iOS 7 device. Is there a way in objective-C that I can check that? Has Apple granted us developers access to check this boolean? i.e. if parallax is enabled do step1 otherwise do step2

How to List TCP/UDP Connections in iOS 4

I am interested in deriving a list of active TCP/UDP network connections on an iOS 4.3 device. Basically, I’m looking for the same type of information one gets from issuing a “netstat -anp tcp” (or the same, but with udp) command under OS X Darwin. I’ve searched Apple’s iOS Developer Library (especially NSNetServices, CFNetServices, and […]

iOS 6.1 Dynamic Library build and link

I am trying to create a dynamic library for iOS and load it at runtime. After taking a look at this question and this answer, I have been doing it using iOSOpenDev and deploying everything on my iPhone. The xCode project for the dylib is called KDylibTwo and the files I modiefied are: KDylibTwo.h #import […]

Resumable assert/breakpoint on iOS like __debugbreak() with MS compiler

I’m trying to implement custom asset macro (similar to what assert.h has), but I want to be able to continue execution after I get and assert. For example, one such ASSERT implementation could be: #define ASSERT(expr) ((void)( (!!(expr)) || (__debugbreak(), 0))) __debugbreak is an intrinsic function in Microsoft compilers that inserts software breakpoint, equivalent to […]

Access to container view controller

I have simple ViewController which have one container view with TableViewController. At ViewController I loading data from external API and one part of that data, I need to pass into TableViewController in container. Is there any way how to do that? Thank you!

repeat playing automatically

I use below code for play sound NSURL* musicFile = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@”01″ ofType:@”mp3″]]; AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:musicFile error:nil]; [audioPlayer play]; I want to repeat this sound file automatically when it’s finish How ?

Adding a subview to UIButton

I’m trying to add a customBadge as a subview of a UIButton – this is my code so far – //msg count initiaition //CustomBadge *customBadge1 = [CustomBadge customBadgeWithString:@”2″]; CustomBadge *customBadge1 = [CustomBadge customBadgeWithString:@”2″ withStringColor:[UIColor whiteColor] withInsetColor:[UIColor redColor] withBadgeFrame:YES withBadgeFrameColor:[UIColor redColor] withScale:2.0 withShining:YES]; // Set Position of Badge 1 [customBadge1 setFrame:CGRectMake(self.view.frame.size.width/2-customBadge1.frame.size.width/2+_MsgHeadBtn.frame.size.width/2, 110, customBadge1.frame.size.width, customBadge1.frame.size.height)]; //add badge […]

NSData dataWithContentsOfURL: not returning data for URL that shows in browser

I am making an iOS client for the Stack Exchange API. After a long, drawn out fight I finally managed to implement authentication – which gives me a token I stick into a URL. When the token is valid, the URL looks like this: https://api.stackexchange.com/2.1/me/associated?key=_____MY_SECRET_KEY______&access_token=_____ACCESS_TOKEN_:)_____ which, when valid, brings me to this JSON in a […]