What I'm trying to do is make it so after they press done on the pop up keyboard, if the text is nil...no object is added to the array, but if its not nil then create the object and add it to the array.
Heres the code I have
Heres the code I have
Code:
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
if (!self.theList)
{
self.theList = [[NSMutableArray alloc] init];
}
Paper *newItem = [[Paper alloc]init];
newItem.listName = textField.text;
if (newItem.listName == nil)
{
[textField resignFirstResponder];
[self.collectionView reloadData];
}
else {
[self.theList addObject:newItem];
textField.text = nil;
NSLog(@"Count %d",self.theList.count);
[textField resignFirstResponder];
[self.collectionVIew reloadData];
}
return YES;
}