iPhone - How add a final line in a UITableView to add items, preventing rearranging of this line -


मेरे पास एक UITableView संपादित मोड में डाल दिया है।

  Self.tableView.editing = हाँ;   

इस तालिका दृश्य में, मुझे कस्टम कक्ष में कुछ पंक्तियां दिखाई देती हैं, और मैं अंत में एक जोड़ना चाहूंगा जो उपयोगकर्ता को एक आइटम जोड़ने की अनुमति देगा (दूसरे दृश्य का उपयोग करके) )

तो मैं कुछ लाइनों ने लिखा है:

  - (NSInteger) tableView:। (UITableView *) tableView numberOfRowsInSection: (NSInteger) अनुभाग {वापसी "लाइनों की संख्या" + 1; } - (BOOL) तालिकादृश्य: (UITableView *) तालिकादृश्य चाहिए चाहिएखबरएडटिंग RowAtIndexPath: (NSIndexPath *) indexPath {वापसी हाँ; } - (UITableViewCellEditingStyle) tableView: (UITableView *) tableView editingStyleForRowAtIndexPath: (NSIndexPath *) indexPath {if (indexPath.row + 1 = [tableView numberOfRowsInSection: 0]!) ​​{वापसी UITableViewCellEditingStyleDelete; } और {वापसी UITableViewCellEditingStyleInsert; }} - (शून्य) tableView: (UITableView *) tableView willDisplayCell: (UITableViewCell *) सेल forRowAtIndexPath: (NSIndexPath *) indexPath {if (indexPath.row + 1 == [tableView numberOfRowsInSection: 0]) {cell.textLabel.text = @ "एक पंक्ति जोड़ें ..."; } अन्य {कस्टम कक्ष में सामान करते हैं}}   

इस तरह से, UITableView किसी भी पंक्ति को पुनर्व्यवस्थित करने की अनुमति देता है। मैं "लाइन जोड़ने" के बाद पहली पंक्ति को स्थानांतरित कर सकता हूं, और पहले स्थान पर "जोड़ पंक्ति" को स्थानांतरित कर सकता हूं।

मैं "ऐड लाइन" सेल पर व्यवस्था बटन कैसे निकाल सकता हूं और इस के तहत जाने के लिए अन्य लाइनों को रोक सकता हूं?

या कोड करने का एक बेहतर तरीका है?

लागू

  - (bool) tableView: (UITableView *) tableView canMoveRowAtIndexPath : (NSIndexPath *) indexPath {वापसी (! [indexPath पंक्ति] = INDEX_OF_SPECIAL_ROW)}   

और

  - (NSIndexPath *) tableView: (UITableView * ) tableView targetIndexPathForMoveFromRowAtIndexPath: (NSIndexPath *) sourceIndexPath toProposedIndexPath: (NSIndexPath *) proposedDestinationIndexPath {अगर ([proposedDestinationIndexPath पंक्ति] & LT; NUMBER_OF_ROWS) {proposedDestinationIndexPath वापसी; } NSIndexPath * otherPath = [NSIndexPath indexPathForRow: NUMBER_OF_ROWS-1 में पता: 0]; वापसी अन्यपाथ; }    

Comments

Popular posts from this blog

android - How can I execute default sms app? -

jquery .css('text-decoration') doesn't work from parents -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -