Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7746] iOS: add a subview at specific index

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsn/a
Reporterprocess
AssigneeUnknown
Created2012-02-13T01:52:49.000+0000
Updated2018-03-06T18:57:58.000+0000

Description

Hello :), Wish it would be great to add a subview at a specific position like in the ios doc : insertSubview:atIndex: https://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/cl/UIView http://developer.appcelerator.com/question/132056/adding-a-view-to-the-beginning-of-a-scrollable-view#comment-113902 Regards

Comments

  1. process 2012-02-15

  2. process 2012-03-05

    Hi, I'm trying hardly to understand the implementation of the sdk to make a custom function. This function would insert a subview in a scrollableView so as to create dynamic content, resolving the case where we need to create subviews o the left. The function would insert a subview in the scrollableView at the desired index. Plus if the index specified is smaller than the index of the current page, then the index of the current page has to be incremented by 1. Doing so, it may don't change the page currently displayed by the container (avoiding the current page to winkle too). I don't know anything about objective-C but i can't implement my project with the standard functions provided by the API, so i ask you humbly if you could help me to do this functionality. I saw that each classes uses a proxy for optimisation purposes, and I guess i'll need to update the file TiUIScrollableViewProxy.m with a function "addViewAtIndex" that would seems like the following :
       -(void)addView:(id)args
       {
           // test
           // NSLog("test" + args);
           
           
       	ENSURE_SINGLE_ARG(args,TiViewProxy);
       
       	[self lockViewsForWriting];
       	[self rememberProxy:args];
       	[args setParent:self];
       	if (viewProxies != nil)
       	{
       		[viewProxies addObject:args]; 
       	}
       	else
       	{
       		viewProxies = [[NSMutableArray alloc] initWithObjects:args,nil];
       	}
       	[self unlockViews];	
       	[self makeViewPerformSelector:@selector(addView:) withObject:args createIfNeeded:YES waitUntilDone:NO];
       }
       
    ... TiUIScrollableViewProxy.m (line 85-90) Many thanks
  3. Stephen Tramer 2012-03-05

    This is a duplicate of an existing bug, which I can't find at the moment.
  4. process 2012-03-09

    If you don't find the duplicate ticket, please do not close it :)
  5. process 2012-03-20

    .
  6. Kabriel Robichaux 2012-10-11

JSON Source