How to make an Expandable TableView with Profile Img?

| | August 18, 2015

I was trying to create a Slide side out menu using the SWRevealViewController but I could not do the expandable TableView and the profile with image + Hello, Name…

what i need

And all I could do was:

what i already done

Basically how do you make an expandable TableView and the profile.

Are there any examples of how to do this?

Connecting drill-down NSSplitView outlets using Storyboards

| | August 18, 2015

I have an NSSplitView that manages a drill-down hierarchy. The parent/left side displays groups, while the child/right side receives notification that the group selection has changed, and updates to display the child items.

However: When creating an NSSplitView using storyboards, there are 3 scenes created: One for the split view itself, and one for each of the right/left NSViewController instances.

The problem here is that I have two controllers that are also acting as NSTableViewDataSource items, and the parent controller should have an IBOutlet to the child controller so that it can provide direct notification that the selection has changed.

But! Because these controllers are in different scenes, I cannot connect them. Nor can I move them both up to the parent scene for the split view, because they would then not have access to the NSTableView outlets. (Nor would the tables reference the controllers as delegates/datasources.)

Do I need to use NSNotification here? It seems so indirect and wishy-washy, and I haven’t found a segue-based approach on the Mac.

enter image description here

Custom UITableViewCell loaded from StoryBoard not getting dealloc'ed

| | August 18, 2015

Here’s my code:

__weak CurrentViewController *weakSelf = self;
if (indexPath.row == 0) //Name Cell
{
    static NSString *CellIdentifier = @"NameCell";
    NameCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    __weak NameCell *weakCell = cell;
    cell.NameDidChangeBlock = ^(){
        weakSelf.zoneName = weakCell.NameTextField.text;
    };

    return cell;
}
else if (indexPath.row == 1) //Number Cell
{
    static NSString *CellIdentifier = @"NumberCell";        
    NumberCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    cell.someBlock = ^(){
        [weakSelf.navigationController popViewControllerAnimated:YES];
    };

    return cell;
}

Neither “NameCell” nor “NumberCell” dealloc method is getting called.
I have both these custom cells designed and put up as top level objects in CurrentViewController’s storyboard.

CurrentViewController’s dealloc is getting called, but custom cell’s dealloc’s aren’t.
I see in the Instruments that the retainCount of the custom cells increases each time creating an instance of CurrentViewController.

Here are my headers of Custom cells:

//NameCell.h:
@property(nonatomic, weak)IBOutlet UITextField *NameTextField;
@property (nonatomic, copy)NameDidChange NameDidChangeBlock;

//NumberCell.h
@property(nonatomic, weak)Manager *manager;
@property(nonatomic, weak)IBOutlet AKPickerView *pickerView;
@property(nonatomic, strong)NSArray *numbersArray;
@property(nonatomic)int selectedZoneNumber;
@property (weak, nonatomic) IBOutlet UIView *selectionBoxView;
@property (nonatomic, copy)some someBlock;

Any help here would be appreciated.
Thanks!

EDIT:
My tableView itself is not getting dealloc’ed after CurrentViewController gets dealloc’ed.
Tried to log through a UITableView category.
Still, guessing, why would my tableView wont get released when my viewController is already released. Seems too weird.

How to make a push segue when a UITableViewCell is selected

| | August 18, 2015

I have a list of effects in a table view. I have created a top right bar button which does a push segue to another view controller which helps create a new effect. Now I want to add push segues to the table view cells so that the effects values maybe loaded on the add effects view controller and and I can save the edited values.

The question is can I create a push segue programmatically? If not can I pass the effect through a prepareforsegue? If I try to use a prepareforsegue, i run into a problem where control dragging from the UITableView does not let me create a push segue to the add effects view controller.

ios 7 document interaction controller hide status bar

| | August 18, 2015

In my iOS app i’ve hidden the status bar with this code in each ViewController:

- (BOOL)prefersStatusBarHidden
{
    return YES;
}

In a view I need to use a UIDocumentInteractionController, but when it comes up, the status bar appears, is there a way to keep it hidden?

Thanks in advance

Submitting to the App Store Using Xcode

| | August 18, 2015

So! Thought this would be easy trying to use TestFlighApp inside itunesconnect but this is what stops me:

this bundle is invalid. the key uirequireddevicecapabilities contains value

How I got this message is: Product > Archive > Success! > Submit to App Store… > Select My Team > Submit > Uploading Archive ( Verifying assets with the iTunes store BAM! Message

Things I’ve Tried

  1. Verified my Project: since this Xcode project was created around 2011, I noticed I had to validate settings by clicking Editor > Validate Settings… didn’t fix my problem. actually created more ;) but all fixed
  2. Added the UIRequiredDeviceCapabilities in Info.plist: I have only arm64 afer removing armv7, armv7s

Let me know if anything else is needed to help help me, I’ll edit :)

How to hide top bar when dragging?

| | August 18, 2015

I have this code and it works with tabbar. How could I do the same thing for top bar ?

There’s the code for tabbar:

-(void)scrollViewDidScroll:(UIScrollView *)scrollView {

    NSInteger yOffset = scrollView.contentOffset.y;
    if (yOffset > 0) {
        self.tabBar.frame = CGRectMake(self.tabBar.frame.origin.x, self.originalFrame.origin.y + yOffset, self.tabBar.frame.size.width, self.tabBar.frame.size.height);
    }
    if (yOffset < 1) self.tabBar.frame = self.originalFrame;
 }

Missing Push Notification Entitlement. the app signature's entitlements do not include the "aps-environment"

| | August 18, 2015

I am now working on an app using Apple Push Notification.

And as far as testing goes, it works fine, but Apple keeps emailing me the message below.

I have read on the net, and done as much as I can to avoid this. My App ID is enabled for Push Notification, regenerating my Provisioning Profile (a number of times), refreshing my Accounts in Xcode Preferences and ….
But it keeps coming whatever I do. Am I missing some point? Or should I just ignore it? I fear if I ignore it my app may be rejected.

Anyone with a similar experience?

Dear developer,

We have discovered one or more issues with your recent delivery for “TheAppABC”. Your delivery was successful, but you may wish to correct the following issues in your next delivery:

Missing Push Notification Entitlement – Your app appears to include API used to register with the Apple Push Notification service, but the app signature’s entitlements do not include the “aps-environment” entitlement. If your app uses the Apple Push Notification service, make sure your App ID is enabled for Push Notification in the Provisioning Portal, and resubmit after signing your app with a Distribution provisioning profile that includes the “aps-environment” entitlement. See “Provisioning and Development” in the Local and Push Notification Programming Guide for more information. If your app does not use the Apple Push Notification service, no action is required. You may remove the API from future submissions to stop this warning. If you use a third-party framework, you may need to contact the developer for information on removing the API.

After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to iTunes Connect.*

Regards,

The App Store team

Expanding UICollectionViewCell height on scrolling

| | August 18, 2015

Is there a smooth way through which I can give like row expansion effect while user is scrolling the collection view. I think I might have seen this somewhere, but when I think about it,it looks difficult because we then will have two different UI operations (changing height of row) and collection view is scrolling on main thread at the same time. I am trying it currently by reloading the row and updating the height everytime, which doesnt look pretty. Any suggestions?

I saw this link which is just changing the frame and doesnt work properly as default height of the row remains 0 and it overlaps with other existing cells.
Changing a specific uitableviewcell row height while scrolling a uitableview

How to Wait in Objective-C

| | August 18, 2015

I want to change my UILabel‘s text after 2 seconds.

I tried setting my UILabel‘s text to “A text”, and use sleep(2) and finally changing the text to “Another text”.

But sleep(2) only freezes the app and “Another text” is set without displaying “A text” for 2 seconds.

How may I display “A text” for 2 seconds and then show “Another text”?