This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//创建一个UISegmentedControl实例 | |
NSArray *segmentTextContent = [NSArray arrayWithObjects:@"资讯",@"博客",@"推荐阅读",nil]; | |
UISegmentedControl *segment = [[UISegmentedControl alloc] initWithItems:segmentTextContent]; | |
segment.selectedSegmentIndex = 0; | |
segment.autoresizingMask = UIViewAutoresizingFlexibleWidth; | |
segment.segmentedControlStyle = UISegmentedControlStyleBar; | |
//UISegmentedControl实例添加事件 | |
[segment addTarget:self action:@selector(segmentedControlChangedValue:) forControlEvents:UIControlEventValueChanged]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark UITableViewDataSource required method | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ | |
//mode1 | |
// NSArray *bundle = [[NSBundle mainBundle] loadNibNamed:@"AttractionCell" | |
// owner:self options:nil]; | |
// AttractionCell *cell = (AttractionCell *)[bundle objectAtIndex:0]; | |
//mode2 | |
static NSString *cellName = @"AttractionCell"; | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellName]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// RootViewController.m | |
// ScranDemo | |
// | |
// Created by apple on 13-2-22. | |
// Copyright (c) 2013年 __MyCompanyName__. All rights reserved. | |
// | |
#import "RootViewController.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AnimationViewController.m | |
// StudyiOS | |
// | |
// Created by ZhangYiCheng on 11-9-28. | |
// Copyright 2011 ZhangYiCheng. All rights reserved. | |
// | |
#import "AnimationViewController.h" | |
#import <QuartzCore/QuartzCore.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans | |
xmlns="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:tx="http://www.springframework.org/schema/tx" | |
xmlns:context="http://www.springframework.org/schema/context" | |
xmlns:mvc="http://www.springframework.org/schema/mvc" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans | |
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd | |
http://www.springframework.org/schema/tx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//view设置背景图片 | |
view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"dula.png"]]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
根据文字字体大小计算文字显示需要的高度 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//UIView获取所属的UIViewController范例 | |
-(BookDetailViewController *)viewController{ | |
for (UIView *next = [self superview]; next; next = [next superview]) { | |
UIResponder *nextResponder = [next nextResponder]; | |
if ([nextResponder isKindOfClass:[BookDetailViewController class]]) { | |
return (BookDetailViewController *)nextResponder; | |
} | |
} | |
return nil; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//控件下载地址:https://github.com/nicklockwood/AsyncImageView | |
//imageview本身有一张默认图片,远程图片请求完后,替换为远程图片 | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
static NSString *CellIdentifier = @"Cell"; | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; | |
if (cell == nil) |
NewerOlder