Thursday, 30 May 2013

Handling CellForRowAtIndexPath Method not calling

Hi All,

In my application I used multiple  tableViews for eg: two. For the first table all delegate and datasource methods are called. When I add the second table and call the method
[self.tableView reloadData];
cellForRowAtIndex method is not called. In the second table, the number of sections is 1 and the number of rows is 5. I set the delegate and datasource for tableView programatically.

add the following asserts to your code (before the call to reloadData) and see what happens: NSAssert(self.tableView, @"No tableview"); NSAssert(self.tableView.dataSource, @"No datasource")

When NSAssert(self.tableView.dataSource, @"No datasource"); is crashing, you haven't set the dataSource of the tableView correctly.
The NSAssert will crash your app if the condition inside the parenthesis of the assert validates to false (or 0, or in this case nil).
Wherever you create your tableView, make sure that you set the dataSource (and probably delegate too) correctly.
Regarding setting the dataSource correctly, don't make the mistake to set the dataSource to a newly created instance of your viewController. Most likely you want to use self.tableView.dataSource = self;.


Solution:

If you are maintaing a multiple views & mulitple tableviews in single view controller, some times CellForRowAtIndexPath Method(DataSource Method) is not calling.


We can handle this by taking another view controller displaying the same class.
ChakriTableViewusingplist[1445:c07] *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-2372/UITableView.m:1070
2013-05-30 12:08:51.779 ChakriTableViewusingplist[1445:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0.  The number of rows contained in an existing section after the update (9) must be equal to the number of rows contained in that section before the update (14), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'
*** First throw call stack:
(0x1c90012 0x10cde7e 0x1c8fe78 0xb63f35 0xb6b8d 0xc3846 0xc38c1 0x317d 0xd1384 0x20eb1b 0x10e1705 0x18920 0x188b8 0xd9671 0xd9bcf 0xd96a6 0x2a9f95 0x10e1705 0x18920 0x188b8 0xd9671 0xd9bcf 0xd8d38 0x4833f 0x48552 0x263aa 0x17cf8 0x1bebdf9 0x1bebad0 0x1c05bf5 0x1c05962 0x1c36bb6 0x1c35f44 0x1c35e1b 0x1bea7e3 0x1bea668 0x1565c 0x2342 0x2275)

libc++abi.dylib: terminate called throwing an exception



i got this error while i am editing the table view cells deleting the cell from table view

Wednesday, 29 May 2013

Keep the screen to stay on(with out going to sleep mode) when i taking pictures from camera automatically with out userinterface.


Using PowerMAnager in Android we can keep the screen to stay on(with out going to sleep mode) when i taking pictures from camera automatically  with out userinterface.

PowerManager.WakeLock w1;
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
w1 = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag");
w1.acquire();
w1.release();

JSON array of objects


It can be a situation where you got a array of data that should be sent in the JSON format to server via ajax, then you can do the following

<script type="text/javascript" >
groups = ['A', 'B', 'C'];
users  = ['user1', 'user2', 'user3'];

//required format is  [{"group_name" : "A", "leader" : "user1"}, {"group_name" : "B", "leader" : "user2"}, {"group_name" : "C", "leader" : "user3"}]

group_leaders = new Array();

len = groups.length;

for(var i = 0; i < len; i++ ){
    group_leaders.push({"group_name" : groups[i], "leader" : users[i]});
}

alert(JSON.stringify(group_leaders));
</script>

Tuesday, 28 May 2013


 Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.487 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.487 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.488 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.488 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.489 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.489 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.490 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.490 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.491 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.491 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.492 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.492 LearnEnglish[796:c07] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2013-05-29 10:44:41.494 LearnEnglish[796:c07] Unbalanced calls to begin/end appearance transitions for 







i am getting this error while i am using navigation in view controllers.

Device Orientation Issue

Hi Team,

I have a issue when rotating the device . If device is in either LandScape Left/ Right or Portrait/Portrait up Side Down then navigation will be changed according to orientations. But device is either LandScape Left/ Right or Portrait/Portrait up Side Down means (like slight difference in angle of rotation.) . In that case, which direction can take the device either LandScape Left/ Right or Portrait/Portrait up Side Down?

 please find the below image:



Fig 1
 Thanks & Regards,
     R.Anusha

Saturday, 25 May 2013

Hi all,

We have a small issue  in handling tableView dynamically.

When the view loads for first time,its working fine.But I need to reload the table data according to the data we get from web service in the same view.
But while reloading the table, section number is not updating.

For example if I have 9 sections in my table,

for the first time loading its updating from 0 to 8.
But while reloading the table, we are getting the section numbers as 8,0,1,2,3,4,5,6,7,8 instead of 0 to 8 so that we got all the sections of table  in interchanged manner.
Can anyone help me in this aspect?

Thanks,
Tejaswini.