i waz not able to write this in comment so,i pasede here.....
plz have a look
this is array
(NSURL *)prepareSMSUrlForPhoneNumber:(NSString *)inPhoeNumber sender:(NSString *)inSender message:(NSString *)inMessage
{
NSURL * url = nil;
NSString *urlString = [NSString stringWithFormat:@"%@to=%@&from=%@&message=%@&sandbox=false&usr=%@&pwd=%@",
kSendingURL,inPhoeNumber,inSender,inMessage,kUser,kPassword];
appdelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
appdelegate.completeToArray = [[NSMutableArray alloc]init];// initWithCapacity:20];
[appdelegate.completeToArray addObject:inSender ];
// [appdelegate.completeToArray insertObject:inSender atIndex:0];
// [appdelegate.completeToArray insertObject:@"NewObject" atIndex:0];
// [appdelegate.completeToArray writeToFile:filePath atomically:YES];
appdelegate.completeFromArray = [[NSMutableArray alloc]init];// initWithCapacity:20];
[appdelegate.completeFromArray addObject:inPhoeNumber];
//[appdelegate.completeFromArray insertObject:inPhoeNumber atIndex:0];
appdelegate.completeMessageArray = [[NSMutableArray alloc]init];// initWithCapacity:20];
[appdelegate.completeMessageArray addObject:inMessage];
//[appdelegate.completeMessageArray insertObject:inMessage atIndex:0];
// [appdelegate.completeMessageArray insertObject:inSender atIndex:1];
///////////////////////////////////
//if (appdelegate.completeToArray == nil) {
// appdelegate.completeToArray = [[NSMutableArray alloc] initWithCapacity:20];
// [appdelegate.completeToArray addObject:inSender];
// [defaults setObject:appdelegate.completeToArray forKey:@"toKey"];
// [appdelegate.completeToArray release];
// }
///////////////////////////////////
/////////////
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"hh:mm aaa dd.MMMM.yyyy"];
NSDateFormatter *timeFormat = [[NSDateFormatter alloc] init];
[timeFormat setDateFormat:@"HH:mm:ss"];
NSDate *now = [[NSDate alloc] init];
NSString *theDate = [dateFormat stringFromDate:now];
NSString *theTime = [timeFormat stringFromDate:now];
NSLog(@"\n"
"theDate: |%@| \n"
"theTime: |%@| \n"
, theDate, theTime);
[dateFormat release];
[timeFormat release];
[now release];
appdelegate.completeDayArray = [[NSMutableArray alloc] init];
[appdelegate.completeDayArray addObject:theDate];
// [appdelegate.completeDayArray insertObject:theDate atIndex:0];
appdelegate.completeTimeArray= [[NSMutableArray alloc] init];
[appdelegate.completeTimeArray addObject:theTime];
// [appdelegate.completeTimeArray insertObject:theTime atIndex:0];
/////////////
url = [ [NSURL alloc] initWithString:urlString];
return [url autorelease];
}
//////////////////////////////////////
and this is table
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
//int count = [arrayTemaplate count];
//int countsentSms = [arraySentSms count];
//if(self.editing) count++;
//return count;
return 1; //[arraySentSms count];
}
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//////////////////////////// customize cell////////////////
static NSString *CellIdentifier2 = @"Cell2";
static NSInteger toTag = 1;
static NSInteger fromTag = 2;
static NSInteger messageTag = 3;
static NSInteger timeTag = 5;
UITableViewCell *cell2 = [tableView dequeueReusableCellWithIdentifier:CellIdentifier2];
if (cell2 == nil) {
cell2 = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier2] autorelease];
cell2.textLabel.textColor = [UIColor whiteColor];
CGRect frame;
frame.origin.x = 5;
frame.origin.y = 3;
frame.size.height = 15;
frame.size.width = 300;
UILabel *fromLabel = [[UILabel alloc] initWithFrame:frame];
fromLabel.font = [UIFont boldSystemFontOfSize:12.0];
fromLabel.textColor = [UIColor whiteColor];
fromLabel.backgroundColor = [UIColor blackColor];
fromLabel.tag = fromTag;
[cell2.contentView addSubview:fromLabel];
[fromLabel release];
//frame.origin.x += 180;
// frame.origin.y = 10;
// UILabel *dayLabel = [[UILabel alloc] initWithFrame:frame];
// dayLabel.font = [UIFont boldSystemFontOfSize:12.0];
// dayLabel.textColor = [UIColor blueColor];
// dayLabel.backgroundColor = [UIColor blackColor];
// dayLabel.tag = dayTag;
// [cell2.contentView addSubview:dayLabel];
// [dayLabel release];
frame.origin.x += 170;
frame.origin.y = 6;
UILabel *timeLabel = [[UILabel alloc] initWithFrame:frame];
timeLabel.font = [UIFont boldSystemFontOfSize:12.0];
timeLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin;
timeLabel.textColor = [UIColor blueColor];
timeLabel.backgroundColor = [UIColor blackColor];
timeLabel.tag = timeTag;
[cell2.contentView addSubview:timeLabel];
[timeLabel release];
frame.origin.x = 5;
frame.origin.y = 18;
UILabel *toLabel = [[UILabel alloc] initWithFrame:frame];
toLabel.font = [UIFont boldSystemFontOfSize:12.0];
//toLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
toLabel.textColor = [UIColor whiteColor];
toLabel.backgroundColor = [UIColor blackColor];
toLabel.tag = toTag;
[cell2.contentView addSubview:toLabel];
[toLabel release];
frame.origin.x = 5;
frame.origin.y = 30;
UILabel *messageLabel = [[UILabel alloc] initWithFrame:frame];
messageLabel.font = [UIFont boldSystemFontOfSize:12.0];
//messageLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
messageLabel.textColor = [UIColor whiteColor];
messageLabel.backgroundColor = [UIColor blackColor];
messageLabel.tag = messageTag;
[cell2.contentView addSubview:messageLabel];
[messageLabel release];
}
UILabel *fromLabel = (UILabel *) [cell2.contentView viewWithTag:fromTag];
UILabel *toLabel = (UILabel *) [cell2.contentView viewWithTag:toTag];
UILabel *messageLabel = (UILabel *) [cell2.contentView viewWithTag:messageTag];
UILabel *timeLabel = (UILabel *) [cell2.contentView viewWithTag:timeTag];
///
// int i = 0;
// for (NSArray *count in appdelegate.completeToArray) {
// [appdelegate.completeToArray addObject:[NSIndexPath indexPathForRow:i++ inSection:0]];
// i++
// }
////
appdelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
fromLabel.font = [UIFont boldSystemFontOfSize:14.0f];
toLabel.font = [UIFont boldSystemFontOfSize:14.0f];
messageLabel.font = [UIFont boldSystemFontOfSize:10.0f];
fromLabel.text = [NSString stringWithFormat:@"To : %@",[appdelegate.completeFromArray objectAtIndex:indexPath.row]] ;
toLabel.text = [NSString stringWithFormat:@"From : %@",[appdelegate.completeToArray objectAtIndex:indexPath.row]];
messageLabel.text = [appdelegate.completeMessageArray objectAtIndex:indexPath.row];
timeLabel.text = [appdelegate.completeDayArray objectAtIndex:indexPath.row];
return cell2;
/////////////////////customize cell//////////
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
cell.hidesAccessoryWhenEditing = YES;
}
int count = 0;
if(self.editing && indexPath.row != 0)
count = 1;
NSLog([NSString stringWithFormat:@"%i,%i",indexPath.row,(indexPath.row-count)]);
// Set up the cell...
if(indexPath.row == ([arraySentSms count]) && self.editing){
//cell.text = @"add new row";
return cell;
}
cell.text = [arraySentSms objectAtIndex:indexPath.row];
return cell;
}