Yet more new information. Was: Re: Weird UITableView problem

2015-04-30 Thread William Squires
Okay, I've now tried this on Xcode 5 and 6, and on 10.8.5 and 10.10.3. Here's 
my synopsis:

* Happens only with UITableView
* Happens on simulator if set for any device (except iPad?) that has retina 
display
* Does not happen if set for a non-retina device.
* Unknown if this happens on real devices (retina or not).
* Happens regardless of the scale factor of the simulator display if the Mac 
does not have a retina display. Unkonwn what happens if your Mac does have a 
retina display (I don't have one.)
* Happens with Swift or ObjC project
* If set for iPad Air, all the rows are available, plus about 3 to 4 blank 
ones - this happens regardless of the scale factor (by available, meaning you 
can see them, or scroll down to see them.) If the scale factor is set to see 
all the simulator screen, then the (simulated) UITableView has no scroller and 
you can see all 20 of the rows, plus 3 blank ones (the rows are there, but have 
no cell.textLabel.text)

This is a fairly easy project to duplicate. Just create a Single View iOS 
project with target iOS 7+, for Universal, and either ObjC or Swift. Add a 
UITableView to the main view, set your view controller to implement 
UITableViewDelegate and UITableViewDataSource. Connect the outlets to the view 
controller in IB. Set up some content (an array of 20 or so items), and feed 
it to the UITableView via tableView:numberOfRowsInSection: and 
tableView:cellForRowAtIndexPath: then set your target device to iPad air, and 
then again to some iPhone (say, 5s, or 6) that has a retina display.

If possible, I'd like someone to try this on an actual iPhone, as well as to 
try it on the simulator on an iMac that does have a retina display.


On Apr 28, 2015, at 11:45 AM, William Squires wsqui...@satx.rr.com wrote:

 Thinking this was a Swift problem, I recreated the project, but with ObjC as 
 the language. I set up the UI the same as with the Swift project. It too, 
 only shows a subset of the array, only this one shows 15 rows, not 13. Here's 
 the ViewController.m
 
 //
 //  ViewController.m
 //  SimpleObjCTable
 //
 //  Created by William Squires on 4/28/15.
 //  Copyright (c) 2015 William Squires. All rights reserved.
 //
 
 #import ViewController.h
 
 @interface ViewController ()
 
 @property NSArray *dwarves;
 
 @end
 
 @implementation ViewController
 
 - (void)viewDidLoad
 {
 [super viewDidLoad];
 self.dwarves = [NSArray arrayWithObjects:@Sleepy,
@Sneezy,
@Bashful,
@Happy,
@Doc,
@Grumpy,
@Dopey,
@Thorin,
@Dorin,
@Nori,
@Ori,
@Balin,
@Dwalin,
@Fili,
@Kili,
@Oin, // These are not shown.
@Gloin,
@Bifur,
@Bofur,
@Bombur,
nil];
 
 // Do any additional setup after loading the view, typically from a nib.
 }
 
 - (void)didReceiveMemoryWarning
 {
 [super didReceiveMemoryWarning];
 
 // Dispose of any resources that can be recreated.
 }
 
 #pragma mark UITableView Methods
 
 -(NSInteger)tableView:(UITableView *)tableView 
 numberOfRowsInSection:(NSInteger)section
 {
 NSInteger theCount = [self.dwarves count];
 
 NSLog(@theCount = %ld, theCount);
 return theCount;
 }
 
 -(UITableViewCell *)tableView:(UITableView *)tableView 
 cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
 NSLog(@indexPath.row = %ld, indexPath.row);
 UITableViewCell *cell = [tableView 
 dequeueReusableCellWithIdentifier:@SimpleTableIdentifier];
 if (cell == nil)
  {
  cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 
 reuseIdentifier:@SimpleTableIdentifier];
  }
 cell.textLabel.text = [self.dwarves objectAtIndex:indexPath.row];
 return cell;
 }
 
 @end
 
 running it gives me (in the debug console) 4 instances of theCount = 20, 
 followed by 15 lines of indexPath.row = 0 up to indexPath.row = 14 (15 
 total, which corresponds to the comment in the initialization line for 
 dwarves = NSArray... line above.) In both cases (the Swift project, and the 
 ObjC project) I use the default view (with the size class w:any, h:any) and 
 pin the UITableView to the edges of the parent view.
  Now I'm totally lost as to why only a limited subset of the rows are being 
 shown, especially given that tableView:numberOfRowsInSection: consistently 
 returns 20 (the number of items initializing the array). HELP!!
 
 On Apr 26, 2015, at 11:29 AM, William Squires wsqui...@satx.rr.com wrote:
 

Re: Yet more new information. Was: Re: Weird UITableView problem

2015-04-30 Thread John Tsombakos
My two cents.. I just tried this on a MacPro, 10.10.3 and Xcode 6 (6.3.1) and 
no matter which device I run in the simulator and scale factor, i can see all 
the items in the list. If looking at the iPad Air, thye all fit on the screen 
without scrolling. Smaller devices I have to scroll the table view.


 On Apr 30, 2015, at 10:44 AM, William Squires wsqui...@satx.rr.com wrote:
 
 Okay, I've now tried this on Xcode 5 and 6, and on 10.8.5 and 10.10.3. Here's 
 my synopsis:
 
 * Happens only with UITableView
 * Happens on simulator if set for any device (except iPad?) that has retina 
 display
 * Does not happen if set for a non-retina device.
 * Unknown if this happens on real devices (retina or not).
 * Happens regardless of the scale factor of the simulator display if the Mac 
 does not have a retina display. Unkonwn what happens if your Mac does have a 
 retina display (I don't have one.)
 * Happens with Swift or ObjC project
 * If set for iPad Air, all the rows are available, plus about 3 to 4 blank 
 ones - this happens regardless of the scale factor (by available, meaning 
 you can see them, or scroll down to see them.) If the scale factor is set to 
 see all the simulator screen, then the (simulated) UITableView has no 
 scroller and you can see all 20 of the rows, plus 3 blank ones (the rows are 
 there, but have no cell.textLabel.text)
 
 This is a fairly easy project to duplicate. Just create a Single View iOS 
 project with target iOS 7+, for Universal, and either ObjC or Swift. Add a 
 UITableView to the main view, set your view controller to implement 
 UITableViewDelegate and UITableViewDataSource. Connect the outlets to the 
 view controller in IB. Set up some content (an array of 20 or so items), 
 and feed it to the UITableView via tableView:numberOfRowsInSection: and 
 tableView:cellForRowAtIndexPath: then set your target device to iPad air, and 
 then again to some iPhone (say, 5s, or 6) that has a retina display.
 
 If possible, I'd like someone to try this on an actual iPhone, as well as to 
 try it on the simulator on an iMac that does have a retina display.
 
 
 On Apr 28, 2015, at 11:45 AM, William Squires wsqui...@satx.rr.com wrote:
 
 Thinking this was a Swift problem, I recreated the project, but with ObjC as 
 the language. I set up the UI the same as with the Swift project. It too, 
 only shows a subset of the array, only this one shows 15 rows, not 13. 
 Here's the ViewController.m
 
 //
 //  ViewController.m
 //  SimpleObjCTable
 //
 //  Created by William Squires on 4/28/15.
 //  Copyright (c) 2015 William Squires. All rights reserved.
 //
 
 #import ViewController.h
 
 @interface ViewController ()
 
 @property NSArray *dwarves;
 
 @end
 
 @implementation ViewController
 
 - (void)viewDidLoad
 {
 [super viewDidLoad];
 self.dwarves = [NSArray arrayWithObjects:@Sleepy,
   @Sneezy,
   @Bashful,
   @Happy,
   @Doc,
   @Grumpy,
   @Dopey,
   @Thorin,
   @Dorin,
   @Nori,
   @Ori,
   @Balin,
   @Dwalin,
   @Fili,
   @Kili,
   @Oin, // These are not shown.
   @Gloin,
   @Bifur,
   @Bofur,
   @Bombur,
   nil];
 
 // Do any additional setup after loading the view, typically from a nib.
 }
 
 - (void)didReceiveMemoryWarning
 {
 [super didReceiveMemoryWarning];
 
 // Dispose of any resources that can be recreated.
 }
 
 #pragma mark UITableView Methods
 
 -(NSInteger)tableView:(UITableView *)tableView 
 numberOfRowsInSection:(NSInteger)section
 {
 NSInteger theCount = [self.dwarves count];
 
 NSLog(@theCount = %ld, theCount);
 return theCount;
 }
 
 -(UITableViewCell *)tableView:(UITableView *)tableView 
 cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
 NSLog(@indexPath.row = %ld, indexPath.row);
 UITableViewCell *cell = [tableView 
 dequeueReusableCellWithIdentifier:@SimpleTableIdentifier];
 if (cell == nil)
 {
 cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 
 reuseIdentifier:@SimpleTableIdentifier];
 }
 cell.textLabel.text = [self.dwarves objectAtIndex:indexPath.row];
 return cell;
 }
 
 @end
 
 running it gives me (in the debug console) 4 instances of theCount = 20, 
 followed by 15 lines of indexPath.row = 0 up to indexPath.row = 14 (15 
 total, which corresponds to the comment in the initialization line for 
 dwarves = NSArray... line above.) In both cases (the Swift project, and the 
 ObjC project) I use the default view 

Re: New information. Was: Re: Weird UITableView problem

2015-04-29 Thread Uli Kusterer
On ٢٨‏/٠٤‏/٢٠١٥, at ١٩:٥٧, William Squires wsqui...@satx.rr.com wrote:
  If I select iPhone Retina (4-inch) (again in the Xcode 5 project), I no 
 longer get all 20 cells, and - in fact - the last cell visible, Dwalin, is 
 cut off so you can't see all of the cell, even with the (table) view scrolled 
 down all the way. This problem appears to have something to do with Retina 
 support/simulation.

 Is it possible that you set up the table view to not auto-resize correctly? If 
you design your XIB at iPhone 5 heights and don't have the scroll view resize 
vertically, then launching it on a smaller iPhone 4 would resize the 
surrounding UIWindow, but not the list in it, so the list would stick out off 
the bottom of your screen and be unreachable.

-- Uli
http://stacksmith http://stacksmith/.org
___

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

New information. Was: Re: Weird UITableView problem

2015-04-28 Thread William Squires
Thinking this was a Swift problem, I recreated the project, but with ObjC as 
the language. I set up the UI the same as with the Swift project. It too, only 
shows a subset of the array, only this one shows 15 rows, not 13. Here's the 
ViewController.m

//
//  ViewController.m
//  SimpleObjCTable
//
//  Created by William Squires on 4/28/15.
//  Copyright (c) 2015 William Squires. All rights reserved.
//

#import ViewController.h

@interface ViewController ()

@property NSArray *dwarves;

@end

@implementation ViewController

- (void)viewDidLoad
{
[super viewDidLoad];
self.dwarves = [NSArray arrayWithObjects:@Sleepy,
@Sneezy,
@Bashful,
@Happy,
@Doc,
@Grumpy,
@Dopey,
@Thorin,
@Dorin,
@Nori,
@Ori,
@Balin,
@Dwalin,
@Fili,
@Kili,
@Oin, // These are not shown.
@Gloin,
@Bifur,
@Bofur,
@Bombur,
nil];
  
// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];

// Dispose of any resources that can be recreated.
}

#pragma mark UITableView Methods

-(NSInteger)tableView:(UITableView *)tableView 
numberOfRowsInSection:(NSInteger)section
{
NSInteger theCount = [self.dwarves count];

NSLog(@theCount = %ld, theCount);
return theCount;
}

-(UITableViewCell *)tableView:(UITableView *)tableView 
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@indexPath.row = %ld, indexPath.row);
UITableViewCell *cell = [tableView 
dequeueReusableCellWithIdentifier:@SimpleTableIdentifier];
if (cell == nil)
  {
  cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 
reuseIdentifier:@SimpleTableIdentifier];
  }
cell.textLabel.text = [self.dwarves objectAtIndex:indexPath.row];
return cell;
}

@end

running it gives me (in the debug console) 4 instances of theCount = 20, 
followed by 15 lines of indexPath.row = 0 up to indexPath.row = 14 (15 
total, which corresponds to the comment in the initialization line for dwarves 
= NSArray... line above.) In both cases (the Swift project, and the ObjC 
project) I use the default view (with the size class w:any, h:any) and pin the 
UITableView to the edges of the parent view.
  Now I'm totally lost as to why only a limited subset of the rows are being 
shown, especially given that tableView:numberOfRowsInSection: consistently 
returns 20 (the number of items initializing the array). HELP!!

On Apr 26, 2015, at 11:29 AM, William Squires wsqui...@satx.rr.com wrote:

 I made a fairly simple iOS app (Single View template, iPhone, Swift) that has 
 a UITableView. I've got it all hooked up, and running the project (in the 
 simulator) shows the table view, but only 13 (out of 20) rows are ever shown.
 
 here's the deal:
 
 ViewController.swift
 
 class ViewController: UIViewController, UITableViewDelegate, UITableViewSource
 {
 private let dwarves = [Sleepy,
   Sneezy,
   Bashful,
   Happy,
   Doc,
   Grumpy,
   Dopey,
   Thorin,
   Dorin,
   Nori,
   Ori,
   Balin,
   Dwalin,
   Fili,  // From here on, these might as well not exist 
 (index = 13)
   Kili,
   Oin,
   Gloin,
   Bifur,
   Bofur,
   Bombur
   ]
 let simpleTableIdentifier = SimpleTableIdentifier
 
 ...
 
 // MARK: UITableViewDataSource/UITableViewDelegate methods
  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) 
 - Int
  {
  return dwarves.count
  }
 
  func tableView(tableView:UITableView, cellForRowAtIndexPath indexPath: 
 NSIndexPath) - UITableViewCell
  {
  var cell = 
 tableView.dequeueReusableCellWithIdentifier(simpleTableIdentifier) as? 
 UITableViewCell
  if (cell == nil)
{
cell = UITableViewCell(style: UITableViewCellStyle.Default, 
 reuseIdentifier: simpleTableIdentifier)
{
  cell!.textLabel?.text = dwarves[indexPath.row]
  return cell
  }
 }
 
 When run, only the first 13 names are shown in the table view; everything 
 from Fili on does not show up. I would expect 

Re: New information. Was: Re: Weird UITableView problem

2015-04-28 Thread Aaron Montgomery
Works for me. Not saying it doesn't work for you, but the problem isn't the 
code.

Created a fresh Single View Application iOS project.
Replaced ViewController.m source with the code below.
Added a UITableView to the View Controller's View and hooked up the DataSource 
to the View Controller.
Ran it in the Simulator.
Scrolled the table and could see all the dwarves.

Aaron

 On Apr 28, 2015, at 9:45 AM, William Squires wsqui...@satx.rr.com wrote:
 
 Thinking this was a Swift problem, I recreated the project, but with ObjC as 
 the language. I set up the UI the same as with the Swift project. It too, 
 only shows a subset of the array, only this one shows 15 rows, not 13. Here's 
 the ViewController.m
 
 //
 //  ViewController.m
 //  SimpleObjCTable
 //
 //  Created by William Squires on 4/28/15.
 //  Copyright (c) 2015 William Squires. All rights reserved.
 //
 
 #import ViewController.h
 
 @interface ViewController ()
 
 @property NSArray *dwarves;
 
 @end
 
 @implementation ViewController
 
 - (void)viewDidLoad
 {
 [super viewDidLoad];
 self.dwarves = [NSArray arrayWithObjects:@Sleepy,
@Sneezy,
@Bashful,
@Happy,
@Doc,
@Grumpy,
@Dopey,
@Thorin,
@Dorin,
@Nori,
@Ori,
@Balin,
@Dwalin,
@Fili,
@Kili,
@Oin, // These are not shown.
@Gloin,
@Bifur,
@Bofur,
@Bombur,
nil];
 
 // Do any additional setup after loading the view, typically from a nib.
 }
 
 - (void)didReceiveMemoryWarning
 {
 [super didReceiveMemoryWarning];
 
 // Dispose of any resources that can be recreated.
 }
 
 #pragma mark UITableView Methods
 
 -(NSInteger)tableView:(UITableView *)tableView 
 numberOfRowsInSection:(NSInteger)section
 {
 NSInteger theCount = [self.dwarves count];
 
 NSLog(@theCount = %ld, theCount);
 return theCount;
 }
 
 -(UITableViewCell *)tableView:(UITableView *)tableView 
 cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
 NSLog(@indexPath.row = %ld, indexPath.row);
 UITableViewCell *cell = [tableView 
 dequeueReusableCellWithIdentifier:@SimpleTableIdentifier];
 if (cell == nil)
  {
  cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 
 reuseIdentifier:@SimpleTableIdentifier];
  }
 cell.textLabel.text = [self.dwarves objectAtIndex:indexPath.row];
 return cell;
 }
 
 @end
 
 running it gives me (in the debug console) 4 instances of theCount = 20, 
 followed by 15 lines of indexPath.row = 0 up to indexPath.row = 14 (15 
 total, which corresponds to the comment in the initialization line for 
 dwarves = NSArray... line above.) In both cases (the Swift project, and the 
 ObjC project) I use the default view (with the size class w:any, h:any) and 
 pin the UITableView to the edges of the parent view.
  Now I'm totally lost as to why only a limited subset of the rows are being 
 shown, especially given that tableView:numberOfRowsInSection: consistently 
 returns 20 (the number of items initializing the array). HELP!!
 
 On Apr 26, 2015, at 11:29 AM, William Squires wsqui...@satx.rr.com wrote:
 
 I made a fairly simple iOS app (Single View template, iPhone, Swift) that 
 has a UITableView. I've got it all hooked up, and running the project (in 
 the simulator) shows the table view, but only 13 (out of 20) rows are ever 
 shown.
 
 here's the deal:
 
 ViewController.swift
 
 class ViewController: UIViewController, UITableViewDelegate, 
 UITableViewSource
 {
 private let dwarves = [Sleepy,
  Sneezy,
  Bashful,
  Happy,
  Doc,
  Grumpy,
  Dopey,
  Thorin,
  Dorin,
  Nori,
  Ori,
  Balin,
  Dwalin,
  Fili,  // From here on, these might as well not exist 
 (index = 13)
  Kili,
  Oin,
  Gloin,
  Bifur,
  Bofur,
  Bombur
  ]
 let simpleTableIdentifier = SimpleTableIdentifier
 
 ...
 
 // MARK: UITableViewDataSource/UITableViewDelegate methods
 func tableView(tableView: UITableView, numberOfRowsInSection section: Int) 
 - Int
 {
 return dwarves.count
 }
 
 func tableView(tableView:UITableView, 

Re: New information. Was: Re: Weird UITableView problem

2015-04-28 Thread William Squires

On Apr 28, 2015, at 12:15 PM, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

 On Apr 28, 2015, at 09:45 , William Squires wsqui...@satx.rr.com wrote:
 
 shows 15 rows
 
 You keep saying “shows”, but you don’t say what this means. A table view can 
 only “show” as many rows as can fit between its top and bottom bounds. The 
 rest are “shown” by scrolling the view.
 
 So, how many rows can fit on the screen? Assuming that’s less than 20, does 
 every visible row “show” content, or are some of the visible rows blank? If 
 you try to scroll the view, is there no scroll bar and no scrollability? If 
 you can scroll it, do blank rows appear at the end?
 
 TBH, it sounds like you’ve forgotten that UITableView doesn’t instantiate 
 cell views for every row in the table, only for the visible rows plus enough 
 nearby rows to make scrolling work smoothly. The rest are instantiated lazily 
 as you scroll.
 
 
  In this case, it means all the rows that can be viewed; not only those that 
show up at the beginning, but those you can scroll to. Only 13 (or 15, for the 
ObjC project) are ever available. All the rows show content (namely, the 
strings in the initialized array, 'dwarves')
  Interestingly enough, if I recreate this project on Xcode 5 on 10.8.5, all 
the rows (20) are shown, plus a few blank ones at the end, if I select iPad 
as the simulator target. This may be because this earlier version doesn't 
support retina, and so the entire screen of the simulator is shown. In the 
original versions, (running on Xcode 6.something on 10.10.?) the whole 
simulator screen is taller than my iMac's screen can display, even for iPhone 
5s as the simulator target, thus I have to scroll the table view to see the 
remaining UITableViewCell instances.
  If I select iPhone Retina (4-inch) (again in the Xcode 5 project), I no 
longer get all 20 cells, and - in fact - the last cell visible, Dwalin, is 
cut off so you can't see all of the cell, even with the (table) view scrolled 
down all the way. This problem appears to have something to do with Retina 
support/simulation.


___

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: New information. Was: Re: Weird UITableView problem

2015-04-28 Thread Quincey Morris
On Apr 28, 2015, at 10:57 , William Squires wsqui...@satx.rr.com wrote:
 
 the whole simulator screen is taller than my iMac's screen can display, even 
 for iPhone 5s as the simulator target, …

So change the display scale to 50% from the simulator’s Window menu.

 … thus I have to scroll the table view to see the remaining UITableViewCell 
 instances

No, you wouldn’t have to scroll the table view, you’d have to scroll the 
simulator’s window (but I don’t recall whether it does scroll).

Do you have a small sample project you can post to GitHub or DropBox or even 
email? It’d be interesting to see if others can see the same behavior.

___

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: New information. Was: Re: Weird UITableView problem

2015-04-28 Thread Quincey Morris
On Apr 28, 2015, at 09:45 , William Squires wsqui...@satx.rr.com wrote:
 
 shows 15 rows

You keep saying “shows”, but you don’t say what this means. A table view can 
only “show” as many rows as can fit between its top and bottom bounds. The rest 
are “shown” by scrolling the view.

So, how many rows can fit on the screen? Assuming that’s less than 20, does 
every visible row “show” content, or are some of the visible rows blank? If you 
try to scroll the view, is there no scroll bar and no scrollability? If you can 
scroll it, do blank rows appear at the end?

TBH, it sounds like you’ve forgotten that UITableView doesn’t instantiate cell 
views for every row in the table, only for the visible rows plus enough nearby 
rows to make scrolling work smoothly. The rest are instantiated lazily as you 
scroll.




___

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