Skip to content

Instantly share code, notes, and snippets.

View bimawa's full-sized avatar
:octocat:
Githubing

Maxim Bunkov bimawa

:octocat:
Githubing
View GitHub Profile
@bimawa
bimawa / ManageKeyboard.m
Last active March 21, 2016 14:15
UIWindow have global notifications for keyboard in iOS devices. How it works i show in this.Read UIWindow class description for study all events. (ReactiveCocoa update)
[[[[[NSNotificationCenter defaultCenter] rac_addObserverForName:UIKeyboardWillChangeFrameNotification
object:nil] takeUntil:[self rac_willDeallocSignal]] deliverOnMainThread] subscribeNext:^(NSNotification *notification) {
CGRect keyboardFrame = [[notification userInfo][UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGRect frameOfScreen = [UIScreen mainScreen].bounds;
}];
@bimawa
bimawa / FadeMask
Created July 25, 2013 09:12
How to set gradient transparent mask for UIVIew.layer. its needs for create scroll fade animation effect.
- (void)viewDidLoad
{
[super viewDidLoad];
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Screen Shot 2013-07-23 at 5.29.05 PM.png"]];
UIView *viewWithMask = [[UIView alloc] initWithFrame:CGRectMake(0, 200, self.view.frame.size.width, 100)];
[viewWithMask setBackgroundColor:[UIColor greenColor]];
// Recreate gradient mask with new fade length
CAGradientLayer *gradientMask = [CAGradientLayer layer];
gradientMask.bounds = viewWithMask.layer.bounds;
gradientMask.position = CGPointMake(CGRectGetMidX(viewWithMask.bounds), CGRectGetMidY(viewWithMask.bounds));
@bimawa
bimawa / UIImage+fixBugs
Created February 26, 2014 09:36
FixRotation method for UIImage.
- (UIImage *)fixRotation:(UIImage *)image
{
if (image.imageOrientation == UIImageOrientationUp)
{
return image;
}
CGAffineTransform transform = CGAffineTransformIdentity;
switch (image.imageOrientation)
{
@bimawa
bimawa / MHViewController.m
Last active August 29, 2015 14:00
MHViewController.m with customization navigationController
- (void)loadView
{
[super view];
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self setEdgesForExtendedLayout:UIRectEdgeBottom];
[self p_configureNavigationBar];
@bimawa
bimawa / Pagin scroll
Last active August 29, 2015 14:04
Create Pagin scroll indicator with scroll effect
- (void)viewDidLoad
{
[super viewDidLoad];
_pageControl = [[UIPageControl alloc] init];
[self.pageControl setCurrentPage:0];
[self.pageControl setNumberOfPages:6];
[self.pageControl addTarget:self action:@selector(a_changedPageControl:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:self.pageControl];
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDECodeSnippetCompletionPrefix</key>
<string>@weakselfnotnil</string>
<key>IDECodeSnippetCompletionScopes</key>
<array>
<string>CodeExpression</string>
</array>
@bimawa
bimawa / UIViewController.m
Created August 13, 2014 05:24
Configure navigationController method for TradeChat
- (void)p_configureNavigationController
{
[[[self navigationController] navigationBar] setTintColor:[UIColor colorWithRed:0.949 green:0.957 blue:0.961 alpha:1.000]];
// Left Button
UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
[leftView setBackgroundColor:[UIColor clearColor]];
UIButton *leftViewButton = [UIButton buttonWithType:UIButtonTypeCustom];
[leftViewButton setFrame:CGRectMake(0, 0, 30, 30)];
[leftViewButton addTarget:self action:@selector(a_pressedNavigationButtonLeft) forControlEvents:UIControlEventTouchUpInside];
@bimawa
bimawa / InjectionViewController.m
Last active August 29, 2015 14:05
Add Injection Event listener
#ifdef INJECTION_ENABLED
[[NSNotificationCenter defaultCenter] addObserverForName:kINNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
}];
#endif
@bimawa
bimawa / UIView.m
Last active August 29, 2015 14:05
Create init methods for UIVIew elements and subclasses
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
[self p_configureView];
[self p_configureConstraints];
}
return self;
//
// UINavigationItem+KVO.m
// Feeder
//
// Created by Brent Royal-Gordon on 7/5/13.
// Copyright (c) 2013 Architechies. All rights reserved.
//
#import "UINavigationItem+KVO.h"