Loading

Wednesday, August 31, 2016

Delete Duplicate Simulators


xcrun simctl list devices | grep -v '^[-=]' | cut -d "(" -f2 | cut -d ")" -f1 | xargs -I {} xcrun simctl delete "{}"

Wednesday, June 8, 2016

Set Constraint

        [ChildView setFrame:ParentView.bounds];
        [ParentView addSubview: ChildView];
        
        [ChildView.centerXAnchor constraintEqualToAnchor: ParentView.centerXAnchor].active = true;

        [ChildView.centerYAnchor constraintEqualToAnchor: ParentView.centerYAnchor].active = true;

Tuesday, May 26, 2015

Do you want the application “Xcode.app” to accept incoming network connections



If you have to allow every time you runs Xcode..
here is the soluation

1. Open command tool
   
2. sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off

3. /usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/Xcode.app/Contents/MacOS/Xcode

4. /usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/Xcode.app/Contents/Developer/Applications/iOS\ Simulator.app/Contents/MacOS/iOS\ Simulator

5. sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on

then restart your system

Tuesday, November 25, 2014

Get Top View of our app

    UIWindow *topWindow = [[[UIApplication sharedApplication].windows sortedArrayUsingComparator:^NSComparisonResult(UIWindow *win1, UIWindow *win2) {
        return win1.windowLevel - win2.windowLevel;
    }] lastObject];

    UIView *topView = [[topWindow subviews] lastObject];

Tuesday, November 18, 2014

Location of Messages in mac


~/Library/Containers/com.apple.iChat/Data/Library/Messages/Archive

Friday, October 31, 2014

Using an NSString in a switch statement

Define Macros

#define CASE(str)                       if ([__s__ isEqualToString:(str)])
#define SWITCH(s)                       for (NSString *__s__ = (s); ; )
#define DEFAULT


Use

SWITCH (string) {
    CASE (@"AAA") {
        break;
    }
    CASE (@"BBB") {
        break;
    }
    CASE (@"CCC") {
        break;
    }
    DEFAULT {
        break;
    }
 }

Tuesday, October 28, 2014

Ipad stuck on the red battery charging

Fixes these items on your Ipad:
  • Device continually restarts but never displays the Home screen.
  • An update or restore did not complete and the device is no longer recognized in iTunes.
  • Stops responding, showing the Apple logo with no progress bar or a stopped progress bar, for over ten minutes.
Here’s what you’ll need to do to get your Ipad into DFU mode:
  • Plug the iPad into your computer
  • Launch iTunes
  • Hold down the Power button and the Home button at the same time
  • Keep holding both of these buttons for 10 seconds
  • After 10 seconds pass, release the Power button but continue to hold the Home button for another 3-5 seconds
  • When in DFU mode, your iPad screen will stay completely black. If you see an Apple logo or otherwise you did not enter DFU mode
  • iTunes will notify you that it has detected a device in recovery mode
  • Once in DFU mode the Itunes firmware modifying app will take over, follow those instructions
What is Ipad DFU mode?
DFU stands for Device Firmware Update, entering DFU Mode allows you to update or re install your Ipad, Ipod, or other iOS device’s firmware.

Thursday, October 16, 2014

Get Root ViewController of StoryBoard

   

UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
    
    UINavigationController *NavController = (UINavigationController*)[mainStoryboard instantiateViewControllerWithIdentifier:@"NavController"];

    UIViewController *TheViewController=[[NavController viewControllers] objectAtIndex:0];

You need to specify the controller identifier for your navigation controller in the attributes inspector of the navigation controller

Friday, September 26, 2014

Get primitive type from NSNumber

 const char* type = [theValue objCType];
if (strcmp (type, @encode (NSInteger)) == 0)
{
    //It is NSInteger
}
else if (strcmp (type, @encode (NSUInteger)) == 0)
{
    //It is NSInteger
}
else if (strcmp (type, @encode (int)) == 0)
{
    //It is NSUInteger
}
else if (strcmp (type, @encode (float)) == 0)
{
    //It is float
}
else if (strcmp (type, @encode (double)) == 0)
{
    //It is double
}
else if (strcmp (type, @encode (long)) == 0)
{
    //It is long
}
else if (strcmp (type, @encode (long long)) == 0)
{
    //It is long long
}

Tuesday, August 19, 2014

Singleton Viewcontroller Storyboard

static id s_singleton = nil;
+ (id) alloc {
    if(s_singleton != nil)
        return s_singleton;
    return [super alloc];
}
- (id) initWithCoder:(NSCoder *)aDecoder {
    if(s_singleton != nil)
        return s_singleton;
    self = [super initWithCoder:aDecoder];
    if(self) {
        s_singleton = self;
    }
    return self;

}

Wednesday, July 10, 2013

Create Navigationcontroller in View based application

    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
    self.Nav=[[UINavigationController alloc] initWithRootViewController:self.viewController];
    
    [self.window setRootViewController:_Nav];
    
    [self.window makeKeyAndVisible];

    return YES;

Friday, March 1, 2013

How can we prevent files/Folder from being backed up to iCloud and iTunes?


 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
    if ([paths count] > 0)
    {
        NSString *documentsDirectory = [paths objectAtIndex:0];
        NSString *NineveshDict=[NSString stringWithFormat:@"%@/YourDir/",documentsDirectory];
        [self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:NineveshDict isDirectory:YES]];
        
    }

-(BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
    if (&NSURLIsExcludedFromBackupKey == nil) { // iOS <= 5.0.1
        const char* filePath = [[URL path] fileSystemRepresentation];
        const char* attrName = "com.apple.MobileBackup";
        u_int8_t attrValue = 1;
        int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0); return result == 0;
    } else { // iOS >= 5.1
        NSError *error = nil;
        BOOL success = [URL setResourceValue: [NSNumber numberWithBool: YES] forKey: NSURLIsExcludedFromBackupKey error: &error];
        if(!success){
            NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
        }
        return success;
    }
}

Wednesday, September 26, 2012

Some New features in iOS 6

1.  Constraints...
     Constraints used for alinement you can turn it on of by clicking  Use Autolayout in File inspector
     By default, Auto Layout is switched on for user interface.

                             


2. UICollectionView
    As per Apple Class reference 
     The UICollectionView class manages an ordered collection of data items and presents them using customizable layouts. Collection views provide the same general function as table views except that a collection view is able to support more than just single-column layouts
     Now you can easily create grid like Photos app, and customize it like UITableView

These are dataSource methods for UICollectionView


- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath

as you can see all are same as UITableView dataSource methods, now you have to create a UICollectionViewCell class , Customize it according to your need and return it in 



 - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath




Here is the YouTube Video For this.



Tuesday, September 25, 2012

Wednesday, July 11, 2012

New Engine for OpenGL

A New Engine for rendering  3D Object....
Easy to use and Fast Processing
NinevehGL