Need job

Looking for job in Europe. Please contact thru LinkedIn profile.

Thursday, February 25, 2016

To fill any image with color

@implementation UIImageView (Utils)

- (void)setImageRenderingMode:(UIImageRenderingMode)mode
{
    if (self.image)
    {
        UIImage* newImage = [self.image imageWithRenderingMode:mode];
        [self setImage:newImage];
    }
}

- (void)fillWithColor:(UIColor*)color
{
    [self setImageRenderingMode:UIImageRenderingModeAlwaysTemplate];
    self.tintColor = color;
}

@end

Tuesday, March 31, 2015

useful localizable category for NSString

"Just code post"

@implementation NSString (Localizable)

- (NSString *)Localizable
{
    return NSLocalizedString(self, nil);

}


Using like this

NSString *newTitle = [@"settingsBarTitle" Localizable];

Tuesday, October 14, 2014

iAd error on iPad


Recently, when I was testing iAd app on iPad, I've got an error when accessing root view.
EXC_BAD_ACCESS code=2




Stack trace was looped infinitely.



We need to analyse the algorithm and change it to prevent call [self view] from error method of iAd delegate.

In my case it was easy:
During UI load my iAd banner already hidden.
I just check if banner is hidden and do nothing.

Here is a link to my post on stackoverflow - http://stackoverflow.com/questions/16471240/using-iads-on-ipad-crashes-after-huge-number-of-calls-to-bannerviewdidfailtorec/26025212#26025212











Friday, July 18, 2014

Xcode auto layout - how to fill removed control space automatically

How to automatically transform picture 1 to pic 2?

pic 1
pic 2

Its all about constraint priority and redundancy.
Priority of space between grey and blue element is higher that grey and bottom of screen.

 

Now if remove blue you will get Pic 2 scene.

Thursday, April 3, 2014

How to use UIRefreshControl without UITableViewController

Exact problem is - How to use static ui elements with table and refresh control.
All you need is storyboard)
This can be achieved with Container view.

The result is:

Monday, March 17, 2014

Objective-C deprecated method mark

Its very useful for big or distributed teams.
To achieve this:

you need to edit the declaration of method to:

- (BOOL)loginComplexWith:(NSArray*)loginTypes andDelegate:(id<LoginComplexDelegate>)delegate __attribute__ ((deprecated));

or you can use DEPRECATED_ATTRIBUTE from <AvailabilityMacros.h>

Thursday, November 14, 2013

How to hide keyboard without first responder

In any place call:
[self.view endEditing:true];
will hide keyboard. 

So, result the same as you call [sender resignFirstResponder] but in this case you need an object or you need to find him.