Skip to content

Instantly share code, notes, and snippets.

Jaison Vieira jaisonv

Block or report user

Report or block jaisonv

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jaisonv / TableViewController.m
Created Jun 15, 2016
Expand / colapse UITableViewCell
View TableViewController.m
NSInteger selectedRow = -1; // default selected row (here no one)
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if(indexPath.row == selectedRow) {
return 100; // expanded height
return 44; // colapsed height
jaisonv / TableViewController.m
Created Jun 15, 2016
Reload single row in a UITableView
View TableViewController.m
// selectedRow is the row to update
NSIndexPath* rowToReload = [NSIndexPath indexPathForRow:selectedRow inSection:0];
NSArray* rowsToReload = [NSArray arrayWithObjects:rowToReload, nil];
[tableView reloadRowsAtIndexPaths:rowsToReload withRowAnimation:UITableViewRowAnimationNone];
jaisonv / TableViewController.m
Created Jun 15, 2016
Remove empty cells that appear before loading
View TableViewController.m
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
View SortArray.m
// 'date' is the property with the date to be sorted by
NSSortDescriptor *dateDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"date" ascending:YES];
NSArray *sortDescriptors = [NSArray arrayWithObject:dateDescriptor];
// 'myArray' is the array that will be sorted
NSArray *sortedEventArray = [myArray sortedArrayUsingDescriptors:sortDescriptors];
jaisonv / TableViewController.m
Created Dec 8, 2016
Reload tableview when scrolling
View TableViewController.m
pageNumber = 1;
-(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
NSInteger currentOffset = scrollView.contentOffset.y;
NSInteger maximumOffset = scrollView.contentSize.height - scrollView.frame.size.height;
if (maximumOffset - currentOffset <= - 40 && hasNextPage)
[self fetchData];
jaisonv / Note.txt
Created Nov 25, 2017
Error running tests on framework when your framework has third party frameworks dependencies
View Note.txt
When adding a third framework to yours you may face the following error if you try to run tests:
The bundle “[framework-name]Tests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
(dlopen_preflight([framework-path]): Library not loaded: @rpath/[third-framework-name].framework/[third-framework-name]
Referenced from: [derived-data-framework-path]
Reason: image not found)
Program ended with exit code: 82
This problem can be solved by adding "$(PROJECT_DIR)" to the "Runpath Search Paths" on the framework's Build Settings.
You can’t perform that action at this time.