page指令的属性: language:jsp页面采用的语言,只有Java,默认为java extends:jsp页面产生的Servlet继承的父类 import:导入包,多个包用逗号隔开 session:是否使用Session,默认值为true buffer:指定输出流缓存大小,默认8kb autoFlush:自动刷新缓冲区,默认为true isThreadSafe:是否线程安全(是否能处理多个线程的同步请求) info:指定jsp页面的相关信息 errorPage:指定出错时跳转的错误页面 contentType:指定MIME类型 isErrorPage:指定当前页面是否为错误处理页面,不能与errorPage同时为true pageEncoding:页面编码,如”UTF-8”,”GBK”,默认为””ISO-8859-1”. page指令不能用于被jsp:include包含的文件,可以在同一页面中多次使用page指令,但是同一属性只能出现一次,除import外。
Eclipse代码提示功能的扩展(输入首字母就提示)
默认情况下,Eclipse的代码提示功能只有在输入.的时候才会触发,即,在你输入点后,提示该对象的方法,字段,变量等,所以,即使有代码提示功能,类名,变量名还是要自己输的。如果一个变量名(或类名)很长,就不好记,也容易出错,虽然Eclipse会报错,但是这样还是会浪费一些时间。我们可以修改一下Eclipse的配置,让它在你输入任意字母时就提示,比如说,你要定义一个String 变量,当输入S时,就会提示String. 打开Window-Preferences-Java-Editor-Content Assist,在Auto Activation triggers for Java 后输:._abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLNMOPQRSTUVWXYZ,点Apply保存,试试写段代码吧。 不过,如果机器性能不好,还是不要这么搞。i7 2670QM+8G DDR3,速度没影响。
第一个Java Web项目
iOS开发没搞定,因为工作需要,必须先学J2EE了。大学的时候学过一学期,但是当时没怎么认真,而且这玩意,考试考完后就没用过,对于个人来说,j2ee成本太高了,国内支持的主机商很少,而且价很高。 第一个J2ee项目,用于学习J2ee项目的基本结构。 功能:hello.jsp,post数据到HelloServlet,HelloServlet处理后返回给hello.jsp. 先上配置文件:WEB-INF/web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name></display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>pocketdigi.HelloServlet</servlet-class>
</servlet>
<!-- servlet名和该servlet完整类名 -->
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
<!-- servlet名和访问该servlet的URL -->
</web-app>
通过上面的配置文件,可以看到,访问HelloServlet的URL是hello.HelloServlet在包pocketdigi内. 在包内建一个类(或者说JavaBean),User.java:
package pocketdigi;
public class User {
private String userName;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
新建一个类,HelloServlet.java:
package pocketdigi;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class HelloServlet extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 3972665671318178043L;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// TODO Auto-generated method stub
String userName=req.getParameter("username");
User user=new User();
user.setUserName(userName);
req.setAttribute("user", user);
//设置待传属性,属性名必须与接收的jsp文件中jsp:useBean标签的id属性相同
RequestDispatcher dispatcher=req.getRequestDispatcher("/hello.jsp");
dispatcher.forward(req, resp);
//把user传送给hell.jsp,这里并不是简单的重定向,注意地址栏,还是Servlet的hello,而不是hello.jsp
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(req, resp);
}
}
hello.jsp 源代码(wp-syntax插件好像不支持JSP高亮显示):
<%@ page language="java" pageEncoding="UTF-8"%>
<jsp:useBean id="user" scope="request" class="pocketdigi.User"></jsp:useBean>
<%--jsp:useBean指令用于在jsp页面中创建一个JavaBean实例,这里就是创建pocketdigi.User的实例
id为JavaBean名,即对象名,class为类名,scope是作用范围,有4个值:request,session,page,application,默认是page。
因为我们需要从Servlet把user通过HttpServletRequest传到这,所以设为request.
这里会自动接收从HelloServlet传过来的user
--%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'hello.jsp' starting page</title>
</head>
<body>
<%
//上面的jsp:useBean指令已经定义user
if (user.getUserName() != null && !user.getUserName().equals("")) {
out.println("您好," + user.getUserName());
}
%>
<form action="hello" method="post">
用户名:<input type="text" name="username" /><br /> <input type="submit"
value="提交" />
</form>
</body>
</html>
部署到服务器,看效果。另外,MyEclipse建立项目的时候,不需要把工作空间设置成Tomcat的webapps目录,我之前一直搞不清,导致部署的时候提示已经部署。其实随便放哪都行,点部署的时候,MyEclipse会把整个项目自动部署到webapps目录,而且修改代码后不需要重新手动部署。
Css 子层相对父层底部对齐
父层:
position:relative;
子层:
position:absolute;
bottom:0;
iOS开发教程电子书推荐《Beginning.iOS.5.Development.Exploring.the.iOS.SDK》iOS5开发基础教程 PDF
《Beginning.iOS.5.Development.Exploring.the.iOS.SDK》,中文名《iOS5开发基础教程》,这个教程基于最新的iOS 5.0系统,不过目前只有英文版,我目前就用这本书作教材学习iOS开发,所以,博客中的文章都是基于这本书上的例子的。如果实在是看不懂,可以下载iOS4的版本,有中文版。但是因为我是初学,而现在最新版的xcode与之前的区别还挺大的(多了ARC等),对照学习起来会有些难度。这个是电子原版的,而不是扫描版,所以没有清晰度的问题,在Kindle DXG中看,效果很好。 目录: Contents ……………………………………………………………………………………………….. v About the Authors ………………………………………………………………………………… xiv About the Technical Reviewer ………………………………………………………………… xv Acknowledgments ……………………………………………………………………………….. xvi Preface ……………………………………………………………………………………………… xvii ■Chapter 1: Welcome to the Jungle ………………………………………………………… 1 ■Chapter 2: Appeasing the Tiki Gods …………………………………………………….. 13 ■Chapter 3: Handling Basic Interaction ………………………………………………….. 45 ■Chapter 4: More User Interface Fun …………………………………………………….. 69 ■Chapter 5: Autorotation and Autosizing ……………………………………………… 113 ■Chapter 6: Multiview Applications …………………………………………………….. 133 ■Chapter 7: Tab Bars and Pickers ……………………………………………………….. 163 ■Chapter 8: Introduction to Table Views ………………………………………………. 217 ■Chapter 9: Navigation Controllers and Table Views ……………………………… 277 ■Chapter 10: Storyboards ………………………………………………………………….. 353 ■Chapter 11: iPad Considerations ……………………………………………………….. 381 ■Chapter 12: Application Settings and User Defaults ……………………………… 407 ■Chapter 13: Basic Data Persistence …………………………………………………… 445 ■Chapter 14: Hey! You! Get onto iCloud! ………………………………………………. 493 ■Chapter 15: Grand Central Dispatch, Background Processing, and You ….. 525 ■Chapter 16: Drawing with Quartz and OpenGL …………………………………….. 563 ■Chapter 17: Taps, Touches, and Gestures …………………………………………… 603 ■Chapter 18: Where Am I? Finding Your Way with Core Location …………….. 633 ■Chapter 19: Whee! Gyro and Accelerometer! ………………………………………. 645 ■Chapter 20: The Camera and Photo Library ………………………………………… 673 ■Chapter 21: Application Localization ………………………………………………….. 685 ■Chapter 22: Where to Next? ………………………………………………………………. 705 Index ………………………………………………………………………………………………… 711 PDF下载: [download id=”33” format=”1”]
Linux Shell脚本执行时提示bad interpreter:No such file or directory的解决
在没有任何语法问题的情况下,之所以出现bad interpreter:No such file or directory,很可能是这个文件是在Windows下编辑的(DOS格式),Windows下的文本编辑器会添加一些不可见的字符(\r\n),而Linux不能识别。 解决方法,把文件转换成UNIX格式即可 打开文件 vi aaa.sh 强制转换成Unix格式: :set ff=unix
iOS开发 给TableView增加SearchBar
效果如图:
可以根据输入的关键字,在TableView中显示符合的数据。 图中分组显示和索引效果,前面的博文已经记录,不再赘述。下面的例子是基于前文的基础上修改的,所以文件名啥的,请参考前文。 第一步是在TableView上方添加一个Search Bar,这里有一点需要注意,必须先把TableView拖下来,留下空间放Search Bar,不要在Table View占满屏幕的情况下把Search Bar拖到Table View顶部。区别在于,使用后面的方法,Search Bar是作为Table View的Header部分添加的,而前面的方法,Search Bar是独立的。在添加索引功能时,如果作为Table View的Header添加,右侧的索引会遮住Search Bar的右边部分。Search Bar几个常用属性: Placeholder是提示,就是hint属性,Corretion是自动修正,一般设为NO,即不修正,Show Cancel Button是显示取消按钮,我这里勾选。选中Search Bar的情况下切换到Connections Inspector面板,delegate与File’s Owner建立连接(我们会在ViewController中支持UISearchBarDelegate协议)。与前面几篇文章的例子相同,ViewController文件名为PDViewController.h和PDViewController.m。 第二步,添加Table View和Search Bar的Outlet.按住Control键,分别拖动Table View和Search Bar到PDViewController.h,添加Outlet 第三步,就是PDViewController代码: PDViewController.h:
#import
@interface PDViewController : UIViewController
@property (strong,nonatomic) NSDictionary *names;
@property (strong,nonatomic) NSMutableDictionary *mutableNames;
@property (strong,nonatomic)NSMutableArray *mutableKeys;
//可变字典和可变数组,用于存储显示的数据,而不可变的字典用于存储从文件中读取的数据
@property (strong, nonatomic) IBOutlet UITableView *table;
@property (strong, nonatomic) IBOutlet UISearchBar *search;
-(void)resetSearch;
//重置搜索,即恢复到没有输入关键字的状态
-(void)handleSearchForTerm:(NSString *)searchTerm;
//处理搜索,即把不包含searchTerm的值从可变数组中删除
@end
PDViewController.m:
#import "PDViewController.h"
#import "NSDictionary+MutableDeepCopy.h"
@implementation PDViewController
@synthesize names=_names;
@synthesize mutableKeys=_mutableKeys;
@synthesize table = _table;
@synthesize search = _search;
@synthesize mutableNames=_mutableNames;
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSString *path=[[NSBundle mainBundle] pathForResource:@"sortednames" ofType:@"plist"];
//取得sortednames.plist绝对路径
//sortednames.plist本身是一个NSDictionary,以键-值的形式存储字符串数组
NSDictionary *dict=[[NSDictionary alloc] initWithContentsOfFile:path];
//转换成NSDictionary对象
self.names=dict;
[self resetSearch];
//重置
[_table reloadData];
//重新载入数据
}
- (void)viewDidUnload
{
[self setTable:nil];
[self setSearch:nil];
[super viewDidUnload];
self.names=nil;
self.mutableKeys=nil;
self.mutableNames=nil;
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
//返回分组数量,即Array的数量
return [_mutableKeys count];
//
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if ([_mutableKeys count]==0) {
return 0;
}
NSString *key=[_mutableKeys objectAtIndex:section];
NSArray *nameSection=[_mutableNames objectForKey:key];
return [nameSection count];
//返回Array的大小
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger section=[indexPath section];
//分组号
NSUInteger rowNumber=[indexPath row];
//行号
//即返回第section组,rowNumber行的UITableViewCell
NSString *key=[_mutableKeys objectAtIndex:section];
//取得第section组array的key
NSArray *nameSection=[_mutableNames objectForKey:key];
//通过key,取得Array
static NSString * tableIdentifier=@"CellFromNib";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:tableIdentifier];
if(cell==nil)
{
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:tableIdentifier];
}
cell.textLabel.text=[nameSection objectAtIndex:rowNumber];
//从数组中读取字符串,设置text
return cell;
}
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
if ([_mutableKeys count]==0) {
return 0;
}
NSString *key=[_mutableKeys objectAtIndex:section];
return key;
}
-(NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
return _mutableKeys;
//通过key来索引
}
-(void)resetSearch
{//重置搜索
_mutableNames=[_names mutableDeepCopy];
//使用mutableDeepCopy方法深复制
NSMutableArray *keyarr=[NSMutableArray new];
[keyarr addObjectsFromArray:[[_names allKeys] sortedArrayUsingSelector:@selector(compare:)]];
//读取键,排序后存放可变数组
_mutableKeys=keyarr;
}
-(void)handleSearchForTerm:(NSString *)searchTerm
{//处理搜索
NSMutableArray *sectionToRemove=[NSMutableArray new];
//分组待删除列表
[self resetSearch];
//先重置
for(NSString *key in _mutableKeys)
{//循环读取所有的数组
NSMutableArray *array=[_mutableNames valueForKey:key];
NSMutableArray *toRemove=[NSMutableArray new];
//待删除列表
for(NSString *name in array)
{//数组内的元素循环对比
if([name rangeOfString:searchTerm options:NSCaseInsensitiveSearch].location==NSNotFound)
{
//rangeOfString方法是返回NSRange对象(包含位置索引和长度信息)
//NSCaseInsensitiveSearch是忽略大小写
//这里的代码会在name中找不到searchTerm时执行
[toRemove addObject:name];
//找不到,把name添加到待删除列表
}
}
if ([array count]==[toRemove count]) {
[sectionToRemove addObject:key];
//如果待删除的总数和数组元素总数相同,把该分组的key加入待删除列表,即不显示该分组
}
[array removeObjectsInArray:toRemove];
//删除数组待删除元素
}
[_mutableKeys removeObjectsInArray:sectionToRemove];
//能过待删除的key数组删除数组
[_table reloadData];
//重载数据
}
-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{//TableView的项被选择前触发
[_search resignFirstResponder];
//搜索条释放焦点,隐藏软键盘
return indexPath;
}
-(void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{//按软键盘右下角的搜索按钮时触发
NSString *searchTerm=[searchBar text];
//读取被输入的关键字
[self handleSearchForTerm:searchTerm];
//根据关键字,进行处理
[_search resignFirstResponder];
//隐藏软键盘
}
-(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{//搜索条输入文字修改时触发
if([searchText length]==0)
{//如果无文字输入
[self resetSearch];
[_table reloadData];
return;
}
[self handleSearchForTerm:searchText];
//有文字输入就把关键字传给handleSearchForTerm处理
}
-(void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
{//取消按钮被按下时触发
[self resetSearch];
//重置
searchBar.text=@"";
//输入框清空
[_table reloadData];
[_search resignFirstResponder];
//重新载入数据,隐藏软键盘
}
@end
mutableDeepCopy深复制的方法在NSDictionary+MutableDeepCopy定义,参考iOS/Objective-C开发 字典NSDictionary的深复制(使用category) Table View基本上学完了,附上完整源代码: [download id=”32” format=”1”]
iOS/Objective-C开发 字典NSDictionary的深复制(使用category)
目标:把NSDictionary对象转换成NSMutableDictionary对象,对象内容是字符串数组,需要实现完全复制(深复制)。 如果调用NSDictionary的mutableCopy方法,可以得到一个NSMutableDictionary对象,但这只是浅复制,如果我们修改NSDictionary中数组内的值(当然,数组必须是NSMutableArray),会发现,NSMutableDictionary对象内数组的值也跟着更改了。我们需要增加一个mutableDeepCopy方法来实现深复制,在该方法中,循环复制每一个元素。 要实现这一功能,有两种方法,一是继承,二是使用category。category与继承的区别在于,使用category并不是新建一个类,而是在原类的基础上增加一些方法(使用的时候还是用原类名),这样,我们就不需要修改已经在其他源文件中写好的类名,只需要导入h头文件,再把复制方法修改成我们新增的方法即可。 一、新建Objective-C category文件,我这Category填MutableDeepCopy,Category on填NSDictionary,所以生成的文件是NSDictionary+MutableDeepCopy.h和NSDictionary+MutableDeepCopy.m,生成的文件名很容易理解。 二、两文件源代码: NSDictionary+MutableDeepCopy.h
#import
@interface NSDictionary (MutableDeepCopy)
-(NSMutableDictionary *)mutableDeepCopy;
//增加mutableDeepCopy方法
@end
NSDictionary+MutableDeepCopy.m:
#import "NSDictionary+MutableDeepCopy.h"
@implementation NSDictionary (MutableDeepCopy)
-(NSMutableDictionary *)mutableDeepCopy
{
NSMutableDictionary *dict=[[NSMutableDictionary alloc] initWithCapacity:[self count]];
//新建一个NSMutableDictionary对象,大小为原NSDictionary对象的大小
NSArray *keys=[self allKeys];
for(id key in keys)
{//循环读取复制每一个元素
id value=[self objectForKey:key];
id copyValue;
if ([value respondsToSelector:@selector(mutableDeepCopy)]) {
//如果key对应的元素可以响应mutableDeepCopy方法(还是NSDictionary),调用mutableDeepCopy方法复制
copyValue=[value mutableDeepCopy];
}else if([value respondsToSelector:@selector(mutableCopy)])
{
copyValue=[value mutableCopy];
}
if(copyValue==nil)
copyValue=[value copy];
[dict setObject:copyValue forKey:key];
}
return dict;
}
@end
测试:
#import
#import "NSDictionary+MutableDeepCopy.h"
//导入头文件
int main (int argc, const char * argv[])
{
@autoreleasepool {
NSMutableArray *arr1=[[NSMutableArray alloc] initWithObjects:@"aa",@"bb",@"cc", nil];
NSDictionary *dict1=[[NSDictionary alloc] initWithObjectsAndKeys:arr1,@"arr1", nil];
NSLog(@"%@",dict1);
NSMutableDictionary *dict2=[dict1 mutableCopy];
//浅复制
NSMutableDictionary *dict3=[dict1 mutableDeepCopy];
//深复制
[arr1 addObject:@"dd"];
NSLog(@"%@",dict2);
NSLog(@"%@",dict3);
}
return 0;
}
iOS开发 给TableView增加索引
当TableView显示的数据很多的时间,可以给其添加索引,添加索引后,在TableView的右侧会显示索引的键,手指滑动这里,就可以快速切换到该键对应的数据(好像联系人就是这样的,很久没用iPhone了,不敢肯定,我只有iPod,没联系人). 具体实现代码只需在前文的基础上修改。 打开PDViewController.m,增加一个selector:
-(NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
return _keys;
//通过key来索引
}
上面的这个selector是在UITableViewDataSource中声明的,我们已经支持了这个协议。 Table View的Style属性,不管是默认的Plain还是前文中修改的Grouped都可以。
IOS开发 分组显示TableView
IOS中可以分组显示TableView,效果类似于“设置”程序。 新建项目的步骤不再重复,请参考前文。有一点区别在于,需要把Table View的Style属性设置成Grouped(在Attributes Inspector中)。这里需要先写个plist文件,用于存储需要显示的数据。 plist文件本身对应NSDictionary数据类型,也就是说plist文件,其实是个字典。本例plist文件名为sortednames.plist,内容及结构如下图:
两个字符串数组,键名分别为A,B,当然,你也可以在程序中用代码写NSDictionary,这样就不需要sortednames.plist。 PDViewController.h
#import
@interface PDViewController : UIViewController
@property (strong,nonatomic) NSDictionary *names;
@property(strong,nonatomic)NSArray *keys;
@end
PDAppDelegate.m
#import "PDViewController.h"
#import "NIBCell.h"
@implementation PDViewController
@synthesize names=_names,keys=_keys;
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSString *path=[[NSBundle mainBundle] pathForResource:@"sortednames" ofType:@"plist"];
//取得sortednames.plist绝对路径
//sortednames.plist本身是一个NSDictionary,以键-值的形式存储字符串数组
NSDictionary *dict=[[NSDictionary alloc] initWithContentsOfFile:path];
//转换成NSDictionary对象
self.names=dict;
NSArray *array=[[_names allKeys] sortedArrayUsingSelector:@selector(compare:)];
//取得字典中所有的key,使用compare方法(必须是返回NSComparisonResult的方法)排序
//这里取得的key,对应的值是Array
_keys=array;
}
- (void)viewDidUnload
{
[super viewDidUnload];
self.names=nil;
self.keys=nil;
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
//返回分组数量,即Array的数量
return [_keys count];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
//返回第section个分组的行数
NSString *key=[_keys objectAtIndex:section];
//取得key
NSArray *nameSection=[_names objectForKey:key];
//根据key,取得Array
return [nameSection count];
//返回Array的大小
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger section=[indexPath section];
//分组号
NSUInteger rowNumber=[indexPath row];
//行号
//即返回第section组,rowNumber行的UITableViewCell
NSString *key=[_keys objectAtIndex:section];
//取得第section组array的key
NSArray *nameSection=[_names objectForKey:key];
//通过key,取得Array
static NSString * tableIdentifier=@"CellFromNib";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:tableIdentifier];
if(cell==nil)
{
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:tableIdentifier];
}
cell.textLabel.text=[nameSection objectAtIndex:rowNumber];
//从数组中读取字符串,设置text
return cell;
}
@end