last day (84 days later) » 

6:24 AM
 
Hi Shan....
 
hi
 
Thanks for this.
 
oky no problem
 
Wait... I am giving you my code.
 
6:27 AM
oky
 
#import "CustomTabedCell.h"

@implementation CustomTabedCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code

UIImageView *dashImageView = [[UIImageView alloc]initWithFrame:CGRectMake(40, 20, 500, 5)]; //set width and height hear or in layoutsubviews
dashImageView.backgroundColor = [UIColor redColor];
dashImageView.tag = 12345;
dashImageView.hidden = YES;
 
what abt in controller
 
Code For CustomTabedCell.m
wait.
Noe for viewController.m
View did load
list = [[NSMutableArray alloc]initWithObjects:@"Chicken",@"Chilli",@"salt",@"Oil",nil];
 
no cell for row at index
 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

if (cell == nil) {

cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

}

if ([cell.contentView subviews]){
Sorry wait
 
6:32 AM
ohh noo this method is wrong
 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

if (cell == nil) {

cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

}

if ([cell.contentView subviews]){
 
oky waht are u adding to tableviewcell
label and image rite
 
values coming from array.
yes, label and if user clicks on any cell then imageview with red background should be shown there
 
oky but need to add them in custom cell only not hear, u need to set the properties
can u psat the cell structure i mean how it looks normally and how it looks when it is selected
with image and label
 
Yes, as given in screenshot in my que
normally there will be data stored in an array with no imageview
 
6:36 AM
the red is the image view
and the label rite
 
yes
 
that is strike through the label
 
Imageview will be hidden initially and if user clicks on any cell then imageview will appear on that cell,
ri8
 
ya
 
My data is coming ok but if i click on tableview's any cell i want to set imageview with just red backgroung on that selected cell
 
6:39 AM
hear according to your image, when user taps the next cell , the previous cell will be with red image
 
There is no need to set imageview's image
 
rite
 
yes, if user selects any of the cell, then previously set imageview wil be there and the next one also
 
oky
add this in view controller
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView reloadData];
}
 
k
wht nexty
 
6:50 AM
wait your method - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath is wrong i am editing it
 
alri8
 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

static NSString *CellIdentifier = @"Cell";

CustomTabedCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// cell = [[CustomTabedCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

if (cell == nil) {

cell = [[CustomTabedCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

}
cell.textLabel.font = [UIFont systemFontOfSize:20.0f];
use like this
 
why your code commented
 
where
did u tried this method insted of yours
 
// in every line
 
6:58 AM
ya
do like this and check
 
can you please post the code only required
without commented?
sorry
 
oky
wait
comment your method and use this
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

static NSString *CellIdentifier = @"Cell";

CustomTabedCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {

cell = [[CustomTabedCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

}
cell.textLabel.font = [UIFont systemFontOfSize:20.0f];
cell.textLabel.text = [shoppingList objectAtIndex:indexPath.row];
return cell;
room topic changed to iOS_Help: helping to program ... :) [ios] [ipad] [iphone]
 
Ohh its working. Thnks but if run the app from background the imageview's are hidden
sorry not background bt kill the app from background
 
y mean it will be selected even after user reopen the app
 
No if i start the app again the imageview's disappar. I have to select it again
 
7:02 AM
*you
ya
i didn't understand the senarion
*senario
can u please explain it once again
suppose u re lanches the app it will starts from the beginning as u see once again table will be loaded from the beginning with hidden images
 
means once the imageview appear on any cell then it should be there until the app is not deleted
 
did u move to some other controller after selecting
the tablecontents
 
yes, the imageview doesn't appear if i come back to that view again
from another view
 
ya it will be reinitialised
 
exactly
i want that imageview in the state once it is selected
because everytime i go to that view from another view, imageview is not there. I have to select that cell everytime.
 
7:12 AM
oky then put an array place selected index and set the imageview hide or not
 
means
 
oky wait i will try hear
 
7:31 AM
are u presenting the controller or pushing
are u there
@Manthan are u there
 
yes i am
no am pushing the controller
i was also trying to set bool variable or something bt nothing much worked
 
if u present it will be there as it is
 
pushview controller
ok wait let me try
no it dsnt
if i try to launch again it dsnt
 
what i mean was if u present other controller from this controller it will stay
oky wait
 
wer u frm?
 
7:44 AM
it will be there only rite
i tried
it wont changed
 
hmm
means if u present it stays?
 
no i tried both it will stay
 
ok i'' try this
nd let u knw
 
k
 
if we push it won't?
 
7:46 AM
tell me the control flow what are u doing after user select the tablecells
 
nothing
i just want to show data in a table and if a call is selected then there will be imageview on slected cell
 
u told u are moving to other views
 
not on table bro but on a button click from that view
 
ohh
wait
will check
 
Wer ur from?
 
7:49 AM
india
u
 
india
 
oky where in india
 
Vadodara
U?
 
bangalore
 
ohhk
THanks man for your help.
Ur giving me your valuable time.
 
7:50 AM
welcome
no i am free now
no work
 
But its gud ur helping someone
 
hm i will do my best when i am free
oky let me know what exatly happening
tell me in detail
if i select the cell , red strike image appears on that cell
 
Once if i selct cell, imageview on that cell appears, if i select another imageview appears and on another cells also
 
as u asked in the question
 
and that is perfect
 
7:53 AM
oky
next what to be happen
 
But if i come from another view that red strikes should be der once selected
 
you mean u are pushing it the tableview from another controller rite
 
tableview is a part of my whole view
there are another uicontrols also in a single view
 
ok
 
there is a tablview, buttons,txtfield also
 
7:55 AM
u are each time pushing this view rite
 
yes
 
oky i thought this will be the rootviewcontroller
 
on a button click from dis view, i go to another view
 
move to back
 
form that view i push to this view where there is tableview and another views
 
7:56 AM
oky
wait
 
no only push, i go to multiple views from multiple buttons from a single view
 
i will check
 
Hey, can we meet after an hour or so if ur free? sorry for the interruption.
 
oky
 
nd is it possible that once we select the cell, red strike comes and if we click again that cell, red strike disappears
 
8:04 AM
ya i got now
wait i will try
 
ok i am here
Its a meeting. Can we meet after an hour or so?
Will see u after an hour. have to go.
 
oky
 
8:23 AM
i will update the code
once u come back replace all that i hav mentoned in my answer
@Manthan see my edited answer
i am going to lunch onec i will be back i will update the code stay online
 
9:05 AM
I am here.
ping me en u cm
 
9:17 AM
hi
are u there
 
yes
wer is your edited code?
 
ya one min
 
k
 
ok
u can do this by using user defaults
in the view controller where u are using this tableview
 
what
 
9:27 AM
add this
in the viewcontroller u are using this tableview
@interface SampleViewController ()<UITableViewDataSource,UITableViewDelegate>
{
NSMutableArray *indexes;//to store in defaults
NSMutableArray *indexesRed;
}
ad this in .m file
of controller
are u there
 
yes
ok next
 
i am updating my code if i chat it may be complex
 
alri8
 
check now
 
k
 
9:42 AM
go from beggning
 
where do i put the last method?
 
which one
saving to defaults
 
- (IBAction)actionToPopTheCOntroller:(id)sender
user can come to this view via multiple views
 
while closing this view
 
means there are 4 buttons with IB actions on this tableview so on every single IB action i have to put this code ri8?
 
9:47 AM
no when user selects the cell after user pop's this controller rite at that method
 
form 4 viewcontrollers user can come to this view via pushviewcontroller
 
where u are dismissing this controller
there
 
that is what i am saying. I am not dismissing this view. just push to another views via different IBActions. There is No poponly push form this view
So I have to put this code on every single IBAction from where I am Leaving this view
 
oky
put it and try
 
k wai
t
Its working perfectly man....
Ur a star bro.
Thanks
 
10:02 AM
welcome .. :)
 
Can i ask u one more thing?
 
k
 
in a tableview ri8 nw if we select tableview cell, that cell shows a red strike but is it possible that if we touch it again that red strike should disappear and again after touch it shows red strike?
 
yas
*yes
 
I also need to do this
 
10:05 AM
k wait
 
If u dun mind to help me
 
k
i will edit the code
 
k
 
only change the custom cell.m file
 
Ok
let me know wen u edit
 
10:12 AM
check now
 
k
It is working but I think we also have to change the value of defaults in - (IBAction)actionToPopTheCOntroller:(id)sender
caz it takes the value only which was selected first
when to pop to another view and then come check it
it dsnt show the updated values
 
ya
there is a bug
 
so how to fix?
is it possible?
 
ya
i am checking it
 
ok
 
10:30 AM
almost there
 
ya no probs man
 
finally
change this method
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
if(selected)
{
UIImageView *dashImageVIew = (UIImageView *)[self viewWithTag:12345];
if(dashImageVIew)
{
if(isCellSelected)
{
if(dashImageVIew.hidden)
{
dashImageVIew.hidden = NO;
isCellSelected = NO;
}
else
{
dashImageVIew.hidden = YES;
isCellSelected = YES;
}
}
else
{
if(dashImageVIew.hidden )
{
dashImageVIew.hidden = NO;
isCellSelected = NO;
}
else
{
dashImageVIew.hidden = YES;
isCellSelected = YES;
copy past in customcell.m file
are u there
 
yes
 
did u replaced that method
 
k wait m trying
 
10:38 AM
no not yet
first do wht i say
first replce this and
 
yes i am replacing
 
k
done ... ?
 
no not yet
not done yet
 
k
 
still the lase selected shows
last
 
10:44 AM
stilll changes are there
 
ok
ur changing it ri8?
 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CustomTabedCell *Cell = [tableView dequeueReusableCellWithIdentifier:@"CELL"];
if(Cell == nil)
{
Cell = [[CustomTabedCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CELL"];
}

Cell.textLabel.text = @"Apple";
if([indexes containsObject:[NSNumber numberWithInt:indexPath.row]]) //change the indexesRed to indexes
Cell.dashImageView.hidden = NO;
return Cell;

}
put this
change this in controller
after that
change this
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

if(![indexes containsObject:[NSNumber numberWithInt:indexPath.row]])
{
[indexes addObject:[NSNumber numberWithInt:indexPath.row]];
}
else
{
[indexes removeObject:[NSNumber numberWithInt:indexPath.row]];
}

[tableView reloadData];
}
 
cell for row was already there
u only changed in did select ri8?
 
no no
both
wait just change where i commented
 
k
 
10:47 AM
if([indexes containsObject:[NSNumber numberWithInt:indexPath.row]]) //change the indexesRed to indexes
put this if condition insted of old one
 
ok
 
done...?
after replace this
- (IBAction)actionToPopTheCOntroller:(id)sender //put this in where u are poping this controler
{

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:indexes forKey:@"SELECTED_CELLS"];
[defaults synchronize];
[self.navigationController popViewControllerAnimated:YES];
}
 
wait
 
entire saving method
k
 
whole ibaction chaged?
 
10:49 AM
ya
 
k done
should i test it?
 
now ready to go
 
ok m testing
 
k
 
Its working awesomly well
Thanks genius
 
10:52 AM
welcome
 
Just a small thing
 
k
 
If there are multiple sections then also it will work the same?
 
yes
 
Will I have to change somthng in cellforro or any other method?
 
10:53 AM
no
 
ok
Thanks so much man.... You have been very kind to me on this.
I really appreciate your help for this....
 
it s oky welcome .. )
:)
hapy coding
bye
 
And if i have any query on this i'll msg you in this room.
ok
 
k
 
:-)
bbyr
bbye
 

  last day (84 days later) »