Make vertical scrollbar always visible in UIScrollView

Download :


Add the following statements in the method initWithScrollView:

  • [_scrollView setShowsHorizontalScrollIndicator:NO];
  • [_scrollView setShowsVerticalScrollIndicator:NO];

Comment all the statements in the method hide:


Added the following method declarations

  • - (void)show:(BOOL)animated;
  • + (BOOL)indicatorShouldBeVisibleForScrollView:(UIScrollView *)scrollView;


#import “JTSScrollIndicator.h”
@property (strong, nonatomic) JTSScrollIndicator *indicator;


- (void)viewDidLoad {
[super viewDidLoad];
self.indicator = [[JTSScrollIndicator alloc] initWithScrollView:scrollview];
self.indicator.backgroundColor = [UIColor colorWithRed:5.0/255.0 green:127.0/255.0 blue:231.0/255.0 alpha:1.0];

- (void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
scrollview.contentOffset = CGPointMake(0.0, 1.0);
[self.indicator show:YES];

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
[self.indicator scrollViewDidScroll:scrollView];

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
[self.indicator scrollViewDidEndDragging:scrollView willDecelerate:decelerate];

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
[self.indicator scrollViewDidEndDecelerating:scrollView];

- (void)scrollViewWillScrollToTop:(UIScrollView *)scrollView {
[self.indicator scrollViewWillScrollToTop:scrollView];

- (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView {
[self.indicator scrollViewDidScrollToTop:scrollView];

Objective-C – How to use member variables in the categories.


@interface UIView (ObjectTagAdditions)
@property (nonatomic, retain) id objectTag;


#import <objc/runtime.h>
static char const * const ObjectTagKey = "ObjectTag";

@implementation UIView (ObjectTagAdditions)
@dynamic objectTag;

- (id)objectTag {
    return objc_getAssociatedObject(self, &ObjectTagKey);

- (void)setObjectTag:(id)newObjectTag {
    objc_setAssociatedObject(self, &ObjectTagKey, newObjectTag, OBJC_ASSOCIATION_RETAIN_NONATOMIC);

Cited from :

Convert yyyy-MM-ddTHH:mm:ss.SSSZ format to default timezone

- (NSDate *) localDateStringForISODateTimeString:(NSString *) anISOString

NSDateFormatter *isoDateFormatter = [[NSDateFormatter alloc] init];
[isoDateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"];
[isoDateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]];

NSDateFormatter *userFormatter = [[NSDateFormatter alloc] init];
[userFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]];

NSDate *date = [isoDateFormatter dateFromString:anISOString];
return [dateFormatter dateFromString:[userFormatter stringFromDate:date]];

iOS orientation animation does not happen smoothly

If you apply any changes to the layer of underlying view.

for example,

shadowImageView.layer.masksToBounds = NO;
shadowImageView.layer.shadowOffset = CGSizeMake(-5, 0);
shadowImageView.layer.shadowOpacity = 1.0;

iOS custom UDID

UIImagePickerController is shifted by ~20px

Subclass UIImagePickerController and override

- (BOOL)  shouldAutorotate
return NO;

CoreData: error: (19) PRIMARY KEY must be unique

Set the Z_MAX to largest Z_PK value in the corresponding table.

UPDATE "main"."Z_PRIMARYKEY" SET "Z_MAX" = n where "Z_ENT" = n

Cited from: why is this code raising the coredata error 19 primary key must be unique


Get every new post delivered to your Inbox.

Join 356 other followers