i have 2 views in fame.us app, and slide in EdgeSwapper view, and i want change default effect of EdgeSwapper.show().
I want effect like a smooth transition forward and backwards, how i can do it?
Famo.us is open source, so you could make a copy (clone) of the EdgeSwapper view.
Change the _transformMap function in your new view to a new transform.
Here is a jsBin of a new view called BackSwapper that has a new transform as follows:
function _transformMap(zMax, progress) {
//return Transform.translate(this._size[0] * (1 - progress), 0, zMax * (1 - progress));
return Transform.translate(0, 0, -this._size[0] * (1 - progress));
}
Related
i am trying to create a toolbar with buttons. and the button i want to have is an image rather title. The current non working code is:
let imageName = "yourImage.png"
self.myUIBarButtonBack = UIBarButtonItem(image: UIImage(named: imageName), style:.plain, target: self, action: #selector(onClickBarButton))
I have 2 questions:
1. where should i place the yourImage.png in my application
2. is this code sufficient to render image or i need to do things like putting it into imageView component and make it visible etc. ?
The best approach is to add images in xcassets. This is the best way you can organize images. The concept of App slicing applies here.
You don't need to put the image in image view in the case of bar button item.
Try changing the rendring option as Original Image instead of Default.
One way is create custom button and assign to toolbar like navigationbar
self.navigationItem.hidesBackButton = true
let button = UIButton.init(type: .custom)
button.setImage(UIImage.init(named: "back_icon"), for: UIControlState.normal)
button.addTarget(self, action:#selector(onClickBackBarItem), for: UIControlEvents.touchUpInside)
button.frame = CGRect.init(x: 0, y: 0, width: 25, height: 25)
let barButton = UIBarButtonItem.init(customView: button)
self.navigationItem.leftBarButtonItem = barButton
I'm performing flip view transition on two views, which are bounded in A Container View. Flippng them first time is working fine. On second time views Frame goes out of view.
like
[<UIView: 0x7fc2316aa030; frame = (-154 -529; 0 0); autoresize = RM+BM; layer = <CALayer: 0x7fc2316aa1a0>>]
After flipping again, it shows container view.
It's working fine if I Uncheck "Use Autolayout" in my project.
But wWhat to do if I am using AutoLayout???
Here is code:
#IBAction func flipViews()
{
if a==false
{
UIView.transitionFromView(new, toView: old, duration: 1, options: .TransitionFlipFromLeft, completion: {(isFinished : Bool)
in
print(self.view_Effects.subviews)
// self.old.frame=self.view_Effects.frame
})
a=true
}
else
{
UIView.transitionFromView(old, toView: new, duration: 1, options: .TransitionFlipFromLeft, completion:{(isFinished : Bool)
in
print(self.view_Effects.subviews)
//self.view_Effects.hidden=true
//self.new.frame=self.view_Effects.frame
})
a=false
}
When I layout my views, all start work just fine. When you make a transform, it's important to remember, that autolayout always calculate your views bounds and frame, based on constraints that you set. So, in my case, I just added center vertical and horizontal align, width and height to my rotated view, so the autolayout mechanism knows when exactly my view is. And all goes just fine. Here is a good autolayout tutorial
http://www.raywenderlich.com/50319/beginning-auto-layout-tutorial-in-ios-7-part-1
I'm trying to create an hierarchic window that contains 3 views using CMDIChildWnd, 2 CSplitterWnd's and 3 CFormView's:
A form view that contains a static control
A form to display the main window that I use to view a PDF document
A side panel for some actions related to the main view
The main splitter (containing the MainView and TaskPane) is initialized with 1 row and 2 columns.
The second splitter contains 2 rows and 1 column, containing the Tabs and the main splitter.
This image describes how it should be built:
My problem is that the MainView has no focus and therefore, the tool bar buttons are not enabled for zooming, saving as, etc...
When I'm not using the Banner Splitter, it works fine.
I tried the setActivePane() setFocus() setActiveWindow()
Here is how I create it in the CChildFrame::OnCreateClient()
if (m_BannerSplitter->CreateStatic(this, 2, 1))
{
m_BannerSplitter->CreateView(0,
0,
RUNTIME_CLASS(CBannerView),
CSize(r.Width(),28),
pContext);
m_splitter->CreateStatic(m_BannerSplitter,
1,
2,
WS_CHILD | WS_VISIBLE | WM_SHOWWINDOW,
m_BannerSplitter->IdFromRowCol(1,0));
}
else
{
m_splitter->CreateStatic(this, 1, 2);
}
m_splitter->CreateView(0,
0,
RUNTIME_CLASS(CMainView),
CSize(r.Width()-m_splitter->m_iRightTabFullWidth-14,1),
pContext);
m_splitter->CreateView(0,
1,
RUNTIME_CLASS(CTasksView),
CSize(m_splitter->m_iRightTabFullWidth, 1),
pContext);
m_splitter->SetColumnInfo(1,
m_splitter->m_iRightTabFullWidth,
m_splitter->m_iRightTabFullWidth);
The problem is that the command routing always checks the active view followed by the document.
If all commands should be handled by the appropriate view, no matter what view has the focus just implement your own command routing.
So overwrite CMainFrame::OnCmdMsg.
BOOL CMainFrame::OnCmdMsg(UINT nID,int nCode,void* pExtra,AFX_CMDHANDLERINFO* pHandlerInfo)
{
// Do the standard routing (View, Frame, Application)
if (__super::OnCmdMsg(nID,nCode,pExtra,pHandlerInfo))
return TRUE;
// If not handled ask all other views to handle the command
return m_pBannerView->OnCmdMsg(nID,nCode,pExtra,pHandlerInfo) ||
m_pMainView->OnCmdMsg(nID,nCode,pExtra,pHandlerInfo) ||
m_pTaskView->OnCmdMsg(nID,nCode,pExtra,pHandlerInfo);
}
My code will just offer every command to every available view after it was not handled by the normal routing.
I have found the solution and it was pretty simply.
The object contains the splitters is a CMDIChildWnd that has SetActiveView(CView * view) function.
So I tried to get the view using:
CView *mainView = (CView *)m_splitter->GetDlgItem(m_splitter->IdFromRowCol(0, 0));
and than used from the CChildFrame::OnCreateClient() event
SetActiveView(mainView);
I had trouble removing the selected and down state colors for a spark list using IconItemRender. If you are making a mobile app and using IconItemRender (instead of ItemRenderer) there is no autoDrawBackground property.
I figured I'd drop it in here after figuring it out thanks to this page: http://www.sajeevkumar.com/2012/01/08/flex-4-6-list-mobile-iconitemrenderer-background-image/
You can do the following to muck around with the down and selected colors. For more control over items in a list using IconItemRender look at the LabelItemRenderer class and the drawBackground function.
override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void {
var bgColor:uint = 0xffffff;
graphics.clear();
graphics.beginFill(bgColor,1);
graphics.lineStyle();
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
graphics.endFill();
// Draw the separator for the item renderer
super.drawBorder(unscaledWidth, unscaledHeight);
opaqueBackground = bgColor;
}
I tried setting all possible styles to something other than grey, just to try and get rid of the grey overlay as shown in the "Hello item 1" in the attached image of a list. Nothing worked. I examined the ListSkin class too and didn't fins anything that would draw these. How to get rid of these overlays?
<s:List id="list" width="100%" height="100%"
dataProvider="{dp}"
focusAlpha="0"
contentBackgroundAlpha="0"
contentBackgroundColor="0xFFFFFF"
selectionColor="0xFFFFFF"
downColor="0xFFFFFF"
borderVisible="false"
>
</s:List>
I just helped a client with this same thing. You, basically, have to extend the LabelItemRemderer class to not draw the rectangle. It is not exposed via styles or colors for you to change.
Look at this code (Starting at line 853 in the LabelItemRemderer):
// Selected and down states have a gradient overlay as well
// as different separators colors/alphas
if (selected || down)
{
var colors:Array = [0x000000, 0x000000 ];
var alphas:Array = [.2, .1];
var ratios:Array = [0, 255];
var matrix:Matrix = new Matrix();
// gradient overlay
matrix.createGradientBox(unscaledWidth, unscaledHeight, Math.PI / 2, 0, 0 );
graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, matrix);
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
graphics.endFill();
}
You basically need some way to force this code to not run. You can do this by creating your own itemRenderer from scratch. Or you can extend the LabelItemRenderer, override the drawBackground() method and copy all the parent drawBackground() code into your extended child; minus the block above.
I'd love to see the color exposed as a style or something. I'd love to see a magic property (or style) we could use to make the overlay vanish altogether. Feel free to log this as a bug into the Apache Flex Jira.