Ever wanted to use an UITextView that looks like a rounded UITextFiled? Also, wished it will grow it’s height as you type your text? Well, you are in luck! Here is the swift file you will need.
Objective-C
Strong vs Weak Reference in Cocoa
StandardIn iOS we always end up defining our instance variables as @property (strong)
or @property(weak)
. But what does strong and weak mean, and when to use which one?
In cocoa, an objects memory is managed via a system called retain count. When an object is initialized, its retain count is increased by 1 from zero. And each time it is strongly referenced by someone, the retain count keeps increasing by 1. In ARC (a compile time feature of Apple’s version of automated memory management, acronym of Automatic Reference Counting), it only frees up memory for objects when there are zero strong references to them, or simply put, the retain count is zero.
SHViewPager: Android like view pager control for iOS Version 2.0 finally!
StandardIt has been almost or, more than 2 years I had created this controller called SHViewPager. And to my utmost surprise a lot of people actually got benefited from it. Some of them requested for the support for screen orientation and iPad. I was a bit busy (actually lazy! sorry guys, truly!) to keep the request. Finally after a long wait, I was thinking, why am I not doing it?
SHTwoDimensionalArray : A simple and easy to use two dimensional array for iOS applications.
StandardEver felt the need to use a two dimensional array in you iOS project? Well, I have. So here is what I had done:
- Created a NSObject subclass.
- Taken two private NSMutableArray instances, one for row and one for column.
- Created a nested for loop to traverse those arrays, and fill them with NSNull objects.
- Created a method to insert value/object on the [row][column] index.
So this is fairly easy and straightforward. But wouldn’t it be nicer if you didn’t have to do all these steps and figure out how to write those monotonous codes all by yourself?
My good friend, I have good news for you! I have created a simple CocoaPod to minimize your task!
Creating your own COCOAPOD
StandardNow a days it is fairly common to use CocoaPods to your project as the dependency manager for your iOS and MacOs projects. I have been using it for quite some time now; and to my utter delight, oh boy, I am glad I got to know how to use this masterpiece!
Now to a fairly uncommon scenario, what if you want to create your own pod?
SHViewPager: Custom Controller for iOS
StandardHello everybody,
For a recent project of mine, I had created this custom controller. This is quite similar to the ViewPager control used in Android. I’ve named this controller SHViewPager
, here is the gitHub link.
Continue reading
Objective-C: Space for Every Three Digits of A Number
StandardHi everyone and welcome again to my blog. Today I am going to discuss a quick fix with you guys. Recently I was working in one my projects and came to a point where I had to use a formatter, which will put spaces after every three digit of a decimal number. For example, if the number is 20000, it will make it look like 200 000. Simple and it is vastly used, isn’t it? Continue reading