Wednesday, 5 March 2014
How to add separator line to UITableView Section
UITableViewHeaderFooterView *header = (UITableViewHeaderFooterView *)view; CGRect sepFrame = CGRectMake(0, view.frame.size.height-1, 320, 1); UIView *seperatorView =[[UIView alloc] initWithFrame:sepFrame]; seperatorView.backgroundColor = [UIColor colorWithWhite:224.0/255.0 alpha:1.0]; [header addSubview:seperatorView];
Tuesday, 4 March 2014
UITableView - change section header color iOS 6 and up
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section
{
view.tintColor = [UIColor clearColor];
UITableViewHeaderFooterView *header = (UITableViewHeaderFooterView *)view;
[header.textLabel setTextColor:[UIColor whiteColor]];
}
{
view.tintColor = [UIColor clearColor];
UITableViewHeaderFooterView *header = (UITableViewHeaderFooterView *)view;
[header.textLabel setTextColor:[UIColor whiteColor]];
}
Labels:
Header,
iOS 6,
ios 7,
Section,
TableViewCell,
UITableView
UITableView with Multiple Sections
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2 ;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section==0)
{
return [array1 count];
}
else{
return [array2 count];
}
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
if(section == 0)
return @"Section 1";
if(section == 1)
return @"Section 2";
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
if (indexPath.section==0) {
ObjectData *theCellData = [array1 objectAtIndex:indexPath.row];
Monday, 3 March 2014
Using fontawesome for objective-C iOS Developer
If you like to use fontawesome in your objective C App, I have find a perfect project on github, this is the link:
https://github.com/alexdrone/ios-fontawesome
This category brings this great iconic font on iOS.
https://github.com/alexdrone/ios-fontawesome
FontAwesome+iOS
Font awesome is an iconic font. Read more about it on http://fortawesome.github.com/Font-Awesome/This category brings this great iconic font on iOS.
Usage
First, make sure you haveFontAwesome.ttf bundled in your project and that UIAppFonts key in the project's plist file contains a String item named FontAwesome.ttf
Then add the NSString+FontAwesome category to the project.UILabel *label = [...]
label.font = [UIFont fontWithName:kFontAwesomeFamilyName size:20];
You can now use enums for all the different iconic characterslabel.text = [NSString fontAwesomeIconStringForEnum:FAGithub];
or you can reference them by using the class identifiers listed here http://fortawesome.github.com/Font-Awesome/#all-iconslabel.text = [NSString fontAwesomeIconStringForIconIdentifier:@"fa-github"];
That's it!
For further information have a look to the small demo project!FAImageView
FAImageView is now extended and contains a new property calleddefaultView that is shown when the image is set to nil.
It is possible to use one the font-awesome icon as a default placeholder for an image view.FAImageView *imageView = [[FAImageView alloc] initWithFrame:CGRectMake(0.f, 0.f, 100.f, 100.f)];
imageView.image = nil;
[imageView setDefaultIconIdentifier:@"fa-github"];
License
This project uses the FontAwesome fix made by Pit Garbe that you can find at https://github.com/leberwurstsaft/FontAwesome-for-iOS Version 2.0 of the Font Awesome font, CSS, and LESS files are licensed under CC BY 3.0: http://creativecommons.org/licenses/by/3.0/ A mention of 'Font Awesome - http://fortawesome.github.com/Font-Awesome' in human-readable source code is considered acceptable attribution (most common on the web). If human readable source code is not available to the end user, a mention in an 'About' or 'Credits' screen is considered acceptable (most common in desktop or mobile software)UIFont Class Reference
Overview
The
You do not create UIFont
class provides the interface for getting and setting font information.
The class provides you with access to the font’s characteristics and
also provides the system with access to the font’s glyph information,
which is used during layout. You use font objects by passing them to
methods that accept them as a parameter. UIFont objects using the alloc and init methods. Instead, you use class methods of UIFont, such as preferredFontForTextStyle:,
to look up and retrieve the desired font object. These methods check
for an existing font object with the specified characteristics and
return it if it exists. Otherwise, they create a new font object based
on the desired font characteristics.Font objects are immutable and so it is safe to use them from multiple threads in your app.
Read more: https://developer.apple.com/library/ios/documentation/uikit/reference/UIFont_Class/Reference/Reference.html
Selected Cell Text Color ios code
cell.textLabel.highlightedTextColor = [UIColor blackColor];
Labels:
code,
Color,
iOS Developer,
Selected,
T Shirt,
Table View,
Tees,
Text
Sunday, 2 March 2014
Expanding and Collapsing table view cells in ios
Find a great code for expanding and collapsing table view on apple developer webiste. This is the link:
https://developer.apple.com/library/ios/samplecode/TableViewUpdates/Introduction/Intro.html
"TableViewUpdates" demonstrates how you can use animated updates to open and close sections of a table view for viewing, where each section represents a play, and each row contains a quotation from the play. It also uses gesture recognizers to respond to user input: * A UITapGestureRecognizer to allow tapping on the section headers to expand the section; * A UIPinchGestureRecognizer to allow dynamic changes to the height of table view rows; and * A UILongPressGestureRecognizer to allow press-and-hold on table view cells to initiate an email of the quotation.
https://developer.apple.com/library/ios/samplecode/TableViewUpdates/Introduction/Intro.html
"TableViewUpdates" demonstrates how you can use animated updates to open and close sections of a table view for viewing, where each section represents a play, and each row contains a quotation from the play. It also uses gesture recognizers to respond to user input: * A UITapGestureRecognizer to allow tapping on the section headers to expand the section; * A UIPinchGestureRecognizer to allow dynamic changes to the height of table view rows; and * A UILongPressGestureRecognizer to allow press-and-hold on table view cells to initiate an email of the quotation.
Subscribe to:
Comments (Atom)