Posts

Swift: Make part of text bold

Image
 Hello everyone, You may have encountered situations where you want to display part of your label's string as bold, while keeping the other part as normal. It's very easy using an attributed string. Below is the code that you need to accomplish this. let attrs = [ NSAttributedString . Key . font : UIFont (name: <your custom font name> , size: <your font size> )] let attributedString = NSMutableAttributedString (string:boldText, attributes:attrs as [ NSAttributedString . Key : Any ]) let normalText = normalText let normalString = NSMutableAttributedString (string:normalText) attributedString. append (normalString)          Now, set the attributed string to your UILabel instance. E.g someLabel . attributedText = attributedString That's it. You can play around with this and see how you can achieve other results with the attributed Strings!

Plist find error (Xcode, iOS)

If you have edited a Plist file on your own, it sometimes might not work after adding back to the Xcode project. Finding the error can be cumbersome. However, Macs come with a great tool called plutil . You can directly run it from the command prompt. Just run plutil E.g: plutil /Desktop/MyApp/myplistfile.plist You can easily figure out where the issue is after running the command.

Most useful terminal commands

Below is a list of mostly helpful terminal commands you'd need to get on with your work. I'm planning to keep adding entries to this list later. Print environment variable echo $ E.g:  echo $PATH   would print the PATH variable value Mac Show current Xcode location xcode-select --print-path Print current path (working directory) pwd Perform Load testing (Using Apache AB) You can easily perform a simple load test using Apache AB. Macs come with apache AB installed. You can directly run from the terminal. ab -n  -c E.g:  ab -n 100 -c 5 http://www.google.com/

kSoap2 printing request dump

Hi, kSoap2 is a library for SOAP which is used in Androids. Here's a neat little trick, if you want to see the actual XML sent received. 1. Set httpTransport.debug=true; before making the call 2. Read values from the httpTransport object afterwards String s1 = httpTransport.requestDump; String s2 = httpTransport.responseDump; Have fun !!!

iOS Split Video into frames

Dear all, You may have encountered scenarios where you would like to split a video into several frames at different time intervals. This post is for you if you intend to do the splitting at device level. I presume that you have some reasonable experience with Objective C and XCode such as adding a framework and adding a file. There are several steps to do to get this going. 1. Build an XCode project and add a video file to project. I've worked with .mp4 files. Should work with other standard formats. 2. Add AssetsLibrary framework and AVFoundation frameworks to your project 3. Create a AVAsset object with your video. You need to pass the location of the video as a NSURL object. I added the video(myvid.mp4) as an asset to my project. Therefore, I will use the following method to create the asset object. AVAsset *asset=[AVAsset assetWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"myvid" ofType:@"mp4"]]]; NOTE: If you ne

iOS 7 UISearchBar Issue

Dear all, Transition into iOS 7 introduces a lot of adjustments. One such adjustment is the UISearchBar. If you try to set the UISearchBar to the NavigationBar inside a UIViewController, then it will not work correctly in iOS 7. The workaround for that is to use a UISearchDisplayController. Here are the steps. 1. Create your UISearchBar UISearchBar *newSearchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)]; newSearchBar.showsCancelButton=YES; newSearchBar.delegate=self; 2. Create a UISearchDisplayController and initialise with the UISearchBar & your ViewController UISearchDisplayController *searchDisplayController=[[UISearchDisplayController alloc] initWithSearchBar:newSearchBar contentsController:self]; 3. Set the datasource & delegates of the UISearchDisplayController searchDisplayController.delegate=self;//The delegate of UISearchDisplayController searchDisplayController.searchResultsDataSource=self;//The data source for the search res

Crittercism "is this an employee-facing app" meaning

Hi all, Crittercism is very useful in many of our developments. If you have tried to make a new app with Crittercism, they ask you a question "Is this an employee facing app". Apparently, there seems to be no definition and I couldn't figure it out even with the help of my teammates. So, I asked Crittercism myself and here is their explanation. "The question is asked to find out whether your application will be published in the App Stores for anyone to download (B2C) or whether they will be used internally within your organization or company by employees only (B2E)." Hope this helps you too :)