Re: iOS TableView moving down

2017-04-30 Thread Gerriet M. Denkmann

> On 29 Apr 2017, at 11:56, Saagar Jha  wrote:
> 
> 
> Saagar Jha
> 
>> On Apr 28, 2017, at 20:22, Gerriet M. Denkmann  wrote:
>> 
>>> 
>>> On 23 Apr 2017, at 14:45, Quincey Morris 
>>>  wrote:
>>> 
>>> On Apr 22, 2017, at 23:55 , Gerriet M. Denkmann  wrote:
 
 But now I want to move the table view down 1 cm (leaving 1 cm unused space 
 at the top of the screen above the table view).
 Reason: top of the table view (which contains a SearchField) is rather 
 hard to reach.
 
 But I cannot find a way to do this.
>>> 
>>> Since UITableView is a subclass of UIScrollView, you can just set the 
>>> “contentOffset” property to move its contents away from the top of its 
>>> container.
>>> 
>>> If you need to put a different view in the 1 cm of space above the table 
>>> view, then I guess you need to change the structure. Instead of the the 
>>> root view being or containing a table view, it would have two child views, 
>>> or two container subviews with “embed” segues to child view controllers.
>> 
>> I failed using contentOffset.
>> 
>> So I changed the view controller of my scene from UITableViewController to 
>> UIViewController and added a rectangle and a UITableView.
>> 
>> But using UISearchController proved to be impossible. Even in the old set up 
>> (under UITableViewController) there were several bugs which needed 
>> complicated work arounds.
>> Now there were even more (without work arounds). So I gave up on 
>> UISearchController.
> 
> Well, what were the bugs, exactly?

Two bugs I remember:

1. Tapping on top of the screen usually scrolls the table view back to the top.
This did not happen when a filtered list was displayed.

2. Rotating the phone messed up the position of the search field.


> How are you adding the search controller’s searchBar to the table view?

When I used UISearchController I created it in my subclass of 
UITableViewController:

- (void)viewDidLoad 
{
[super viewDidLoad];
ResultsTableController *resultsController = [[ResultsTableController 
alloc] init];//UITableViewController   
resultsController.tableView.delegate = self;//  
default = resultsController 

UISearchController *searchCntr = [[UISearchController alloc] 
initWithSearchResultsController: resultsController];
searchCntr.delegate = self; 
//  UISearchControllerDelegate 
searchCntr.searchResultsUpdater = self; 
//  UISearchResultsUpdating
searchCntr.dimsBackgroundDuringPresentation = NO;   //  
default is YES
self.searchController = searchCntr;

UISearchBar *searchBar = searchCntr.searchBar;
searchBar.delegate = self;  
//  UISearchBarDelegate 
searchBar.scopeButtonTitles = @[ @"Starts", @"Contains", @"Content" ];
self.tableView.tableHeaderView = searchBar;

self.definesPresentationContext = YES;  
}

Gerriet.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: iOS TableView moving down

2017-04-28 Thread Saagar Jha

Saagar Jha

> On Apr 28, 2017, at 20:22, Gerriet M. Denkmann  wrote:
> 
>> 
>> On 23 Apr 2017, at 14:45, Quincey Morris 
>>  wrote:
>> 
>> On Apr 22, 2017, at 23:55 , Gerriet M. Denkmann  wrote:
>>> 
>>> But now I want to move the table view down 1 cm (leaving 1 cm unused space 
>>> at the top of the screen above the table view).
>>> Reason: top of the table view (which contains a SearchField) is rather hard 
>>> to reach.
>>> 
>>> But I cannot find a way to do this.
>> 
>> Since UITableView is a subclass of UIScrollView, you can just set the 
>> “contentOffset” property to move its contents away from the top of its 
>> container.
>> 
>> If you need to put a different view in the 1 cm of space above the table 
>> view, then I guess you need to change the structure. Instead of the the root 
>> view being or containing a table view, it would have two child views, or two 
>> container subviews with “embed” segues to child view controllers.
> 
> I failed using contentOffset.
> 
> So I changed the view controller of my scene from UITableViewController to 
> UIViewController and added a rectangle and a UITableView.
> 
> But using UISearchController proved to be impossible. Even in the old set up 
> (under UITableViewController) there were several bugs which needed 
> complicated work arounds.
> Now there were even more (without work arounds). So I gave up on 
> UISearchController.

Well, what were the bugs, exactly? How are you adding the search controller’s 
searchBar to the table view?

> 
> Now I have UIView, UISearchBar, UITableView (no more UISearchController) and 
> all seems to be working.
> 
> Gerriet.
> 
> P.S. Is there some official way to get the colour of the UISearchController 
> (like hue: 0.668062, saturation: 0.0255094, brightness: 0.80854) instead of 
> hardcoding these numbers?
> I need this for the backgroundColor of my UIView.
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: iOS TableView moving down

2017-04-28 Thread Gerriet M. Denkmann

> On 23 Apr 2017, at 14:45, Quincey Morris 
>  wrote:
> 
> On Apr 22, 2017, at 23:55 , Gerriet M. Denkmann  wrote:
>> 
>> But now I want to move the table view down 1 cm (leaving 1 cm unused space 
>> at the top of the screen above the table view).
>> Reason: top of the table view (which contains a SearchField) is rather hard 
>> to reach.
>> 
>> But I cannot find a way to do this.
> 
> Since UITableView is a subclass of UIScrollView, you can just set the 
> “contentOffset” property to move its contents away from the top of its 
> container.
> 
> If you need to put a different view in the 1 cm of space above the table 
> view, then I guess you need to change the structure. Instead of the the root 
> view being or containing a table view, it would have two child views, or two 
> container subviews with “embed” segues to child view controllers.

I failed using contentOffset.

So I changed the view controller of my scene from UITableViewController to 
UIViewController and added a rectangle and a UITableView.

But using UISearchController proved to be impossible. Even in the old set up 
(under UITableViewController) there were several bugs which needed complicated 
work arounds.
Now there were even more (without work arounds). So I gave up on 
UISearchController.

Now I have UIView, UISearchBar, UITableView (no more UISearchController) and 
all seems to be working.

Gerriet.

P.S. Is there some official way to get the colour of the UISearchController 
(like hue: 0.668062, saturation: 0.0255094, brightness: 0.80854) instead of 
hardcoding these numbers?
I need this for the backgroundColor of my UIView.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: iOS TableView moving down

2017-04-23 Thread Quincey Morris
On Apr 22, 2017, at 23:55 , Gerriet M. Denkmann  wrote:
> 
> But now I want to move the table view down 1 cm (leaving 1 cm unused space at 
> the top of the screen above the table view).
> Reason: top of the table view (which contains a SearchField) is rather hard 
> to reach.
> 
> But I cannot find a way to do this.

Since UITableView is a subclass of UIScrollView, you can just set the 
“contentOffset” property to move its contents away from the top of its 
container.

If you need to put a different view in the 1 cm of space above the table view, 
then I guess you need to change the structure. Instead of the the root view 
being or containing a table view, it would have two child views, or two 
container subviews with “embed” segues to child view controllers.

> The “Add New Constraints” thingy is all greyed out.

Because you can’t move the root view away from the edges of the window 
(screen). If content offsets won’t do what you want, you have to use subviews, 
which can be laid out.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com