Simulate different network conditions on iOS simulator

When enabled, the Network Link Conditioner can change the network environment of the iPhone Simulator according to one of the built-in presets:
  • EDGE
  • 3G
  • DSL
  • WiFi
  • High Latency DNS
  • Very Bad Network
  • 100% Loss

You can control the internet downlink/uplink bandwidth. BitTorrent/UTorrent some times won’t respect the upload limit so network-link-conditioner will control it.

how to uninstall unnecessary simulators in Xcode?

You can find and delete the simulators from the path /Library/Developer/CoreSimulator/Profiles/Runtimes. Restart Xcode in order to take effect.


You can delete a simulator from Xcode by navigation through Menu > Window > Devices > Simulators.

Change UITextField Placeholder Color

if ([textField respondsToSelector:@selector(setAttributedPlaceholder:)])
textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:textField.placeholder attributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]}];

Multiple methods named found with mismatched result parameter type or attributes

In one scenario, if the factory method that creates the object has return type “id” then the compiler will check the method signature in all the classes. If compiler find the same method signature in more than one class then it will raise the issue. So replace the return type “id” with “specific class name”.

Convert iPad xib to iPhone version

We can go with the following approach to get iPhone version of iPad xibs already exist in the project. With this approach we no need to create a new xib and manually add all the subviews.

1. Xcode recognises the iPhone version of a XIB if the suffix is ~iphone (lowercase only) and iPad version if its ~ipad. If no suffix exists then it will consider it as an iPhone version. Lets suffix all the existing xib names with ~ipad.

2. Duplicate all the xib files and open them in TextEditor and do the following.

change “” to “”
change “iOS.CocoaTouch.iPad” to “iOS.CocoaTouch”
change iPad size (width=”1024″ height=“768”) to iPhone size (width=“320″ height=“568″)

3. Add the xib to the project and open it on Xcode.

4. Select the root view and go to the attributes inspector.

5. Change the orientation to portrait and size to Retina 4-inch Full Screen.

6. Adjust the frame of all the subviews.

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 :

Get every new post delivered to your Inbox.

Join 134 other followers