dimanche 28 juin 2015

Cocoa Windows, not receiving events

For the last few days I've returned to an issue that I've been having for a while now. I've been trying to integrate Cocoa windows into my application, but the [NSApplication run] doesn't fit in with my programs model and getting the user inputs is more difficult than expected, As no event is received by the window.

I checked with XCode the value of _currentEvent and it's consistently nil which leads me to think that the window isn't capturing the events in the first place. I included a screenshot of the window while it's focused, although it doesn't appear to be active as the icons aren't coloured. I've also included the code for the window creation in Objective-C

Note: Calling [application run] does work and I receive inputs with an active looking window once called.

Source: http://ift.tt/1JrC01D

Variables:

Variables

Window:

Window

POST raw json code ios

i'm new to ios developing and i want to ask how can i post a raw json code to the server.

For Example: i want to send this JSON raw data to http://example.com/user

{ "user": 
                {   "username": "jkaaannyaad11",
                    "password": "secret123456",
                    "gender": "male",
                    "first_name": "assd",
                    "last_name": "ffsasd",
                    "birth_date": "can be null",
                    "phone_number": "12343234",
                                                                  "have_car":"1",
                                                                  "same_gender" :"0",
                                                                  "uid": "this is id for facebook , can be null"
                },
            "home": {
                    "longitude": "31.380301",
                    "latitude": "30.054272",
                    "name": "city"
                    },
            "work": {
                    "longitude": "30.068237",
                    "latitude": "31.024275",
                    "name": "village"
                    },
            "email": {
                    "email_type": "work",
                    "email": "hello.me@me.com"
                    }
            }

so how can i do it ?

Dearest Regards,

Slide Out Menu without a back Button

I use SWRevealViewController for my Slide Out Menu. I did actually the same like he did it here: https://www.youtube.com/watch?v=5SUV1YY2yxQ, but even I add a new ViewController and connect it with the segue "reveal view controller", start the app and click on the row to open the view controller, it will works, but I don't have a back Button. Why?

Can this dispatch_once singleton ever return nil?

Trying to find an issue we are experiencing intermittently, that seems to be occurring on devices with low memory conditions. The suspected cause is the NSDateFormatter singleton being nil.

Is there any possible situation where the singleton pattern below could return nil?

+ (NSDateFormatter *)dateFormatterUTC {

    static NSDateFormatter *formatter;
    static dispatch_once_t onceToken;

    dispatch_once(&onceToken, ^{
        formatter = [[NSDateFormatter alloc] init];
        formatter.dateFormat=@"yyyy-MM-dd HH:mm:ss ZZZ";
    });

    return formatter;
}

Dynamic replaceable uiviewcontroller in side a view with bottom static menu ios

How will achieve the above with a bottom static menu and replaceable uiviewcontrollers like fragments in android in the middle part?

iOS Push Notifications handle

Looking for a good practice regarding push notifications handle. currently in my app i'm handling the push notifications in the didFinishLaunchingWithOptions and in the didReceiveRemoteNotification delegates. I noticed that both handling logics are "firing" when i receive a push notifications when the app is "Dead". My remote notifications flag in Background Modes is ON in my app. Is there a good practice for handling this scenario ? why am i getting the push data in the didFinishLaunchingWithOptions(launchOptions) and didReceiveRemoteNotification is getting called too ? to my knowledge the didReceiveRemoteNotification is not spoused to get called when the app is "Dead".

After tableview reload cell not deleted

I have one UIView and inside one table view.After reload data visible cell remains and overlapping another cell in table view.I am using pull to refresh control and using reloadRowsAtIndexPaths.

[self.tableView beginUpdates];
[self.tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationNone];
[self.tableView endUpdates];

If I put something like this :

 if(indexPath.row >5){

                                             [self.tableView beginUpdates];
                                             [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
                                             [self.tableView endUpdates];
                                         }
                                         else {

                                             [self.tableView reloadData];


                                         }

In this scenario there is no overlapping but this is not best solution.