genericspecific / ckuitools Goto Github PK
View Code? Open in Web Editor NEWA collection of Categories and other tools designed to make a developer's life easier
License: MIT License
A collection of Categories and other tools designed to make a developer's life easier
License: MIT License
Happy to fork and push. . .
On a fresh install getting: Unable to find symbol CALayer
Just now I wanted to add a border to a UIView where only the top, left, right are drawn (bottom is empty).
I made a custom class that overrides UIView.
Rather than make this small class, how about a CKDrawbleView where you can add it directly as a sub-view to your view like so:
[myView addSubView:[CKDrawableView alloc] initWithBlock:^(CGRect rect){
//do my drawing here;
}];
Avoids typing: view.frame.size.width . . which is too verbose.
I'm not sure if this is generally useful or not, but if you think so please add:
@implementation UITableView (IndexPaths)
(NSIndexPath_)nextIndexPathGiven:(NSIndexPath_)indexPath
{
NSIndexPath* nextIndexPath = nil;
if ([self canEvaluateNextOrPreviousIndexPathGiven:indexPath])
{
id delegate = self.dataSource;
NSInteger sections = [delegate numberOfSectionsInTableView:self];
NSInteger rowsInSection = [delegate tableView:self numberOfRowsInSection:indexPath.section];
NSInteger nextRow = indexPath.row + 1;
if (nextRow == rowsInSection && indexPath.section <= (sections - 1))
{
nextIndexPath = [NSIndexPath indexPathForRow:0 inSection:indexPath.section + 1];
}
else
{
nextIndexPath = [NSIndexPath indexPathForRow:indexPath.row + 1 inSection:indexPath.section];
}
}
return nextIndexPath;
}
(NSIndexPath_)previousIndexPathGiven:(NSIndexPath_)indexPath
{
NSIndexPath* previousIndexPath = nil;
if ([self canEvaluateNextOrPreviousIndexPathGiven:indexPath])
{
id delegate = self.dataSource;
NSInteger previousRow = indexPath.row - 1;
if (previousRow < 0 && indexPath.section > 0)
{
NSInteger previousSection = indexPath.section - 1;
NSInteger lastRowInSection = ([delegate tableView:self numberOfRowsInSection:previousSection]) - 1;
previousIndexPath = [NSIndexPath indexPathForRow:lastRowInSection inSection:previousSection];
}
else
{
previousIndexPath = [NSIndexPath indexPathForRow:indexPath.row - 1 inSection:indexPath.section];
}
}
return previousIndexPath;
}
(NSIndexPath_)firstIndexPath
{
NSIndexPath_ path = nil;
id delegate = self.dataSource;
NSInteger sections = [delegate numberOfSectionsInTableView:self];
if (sections > 0 && ([delegate tableView:self numberOfRowsInSection:0]) > 0)
{
path = [NSIndexPath indexPathForRow:0 inSection:0];
}
return path;
}
(NSIndexPath_)lastIndexPath
{
NSIndexPath_ path = nil;
id delegate = self.dataSource;
NSInteger sections = [delegate numberOfSectionsInTableView:self];
NSInteger rows = [delegate tableView:self numberOfRowsInSection:sections -1];
if (sections > 0 && rows > 0)
{
path = [NSIndexPath indexPathForRow:rows -1 inSection:sections - 1];
}
return path;
}
/* ============================================================ Private Methods ========================================================= */
Add a CKUITools.h header file that imports everything. . . then I don't have to remember the category names.
I want to use this in a CocoaPods project. . . would be nice if it was in the official specs repo, although I guess I could resolve it as an in-line spec. . .
Steps to reproduce.
UITextView has blank text!!!!!
UITextView is ok.
Wierd. . .
Add the following method:
This is the content frame, which is either the whole screen, or the whole screen minus the status bar.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.